ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

C++ - Saving / Loading data

<< < (2/2)

Crush:
You can write to the data hunks in dlls or exes, but its not so easy to do. You have to take care of the file structure, offsets and pointers. It could be a problem to the program task to write at its own file while running - I think the OS will not allow this (try to delete an .exe while running it in the background).
Viruskillers or other security software will treat these changes as an illegal operation and attack.
Reading and writing to normal text-files is incomparable to the others and much more easier to do.
You seem to need a console application. The listing of the complete content after each new number is for bigger amounts not very nice to look at.
It´s also a little bit strange how to implement a "virtual screen with colors" in a command prompt? Did you try to write to the vga-buffer directly (ASM)?

RedPillow:
This one to make the screen:

[PASCAL]
  Procedure SetMCGA;
  BEGIN
    asm
          mov     ax,0013h
          int     10h
    end;
  END;
[C++]
  void SetMCGA() {
    _AX = 0x0013;
    geninterrupt (0x10);
  }


This one to Delete it:

[PASCAL]
  Procedure SetMCGA;
  BEGIN
    asm
          mov     ax,0013h
          int     10h
    end;
  END;
[C++]
  void SetMCGA() {
    _AX = 0x0013;
    geninterrupt (0x10);
  }


I don`t know what to do with those exactly thou ;S
But can I get that reading/writing example by using txt-file to store the data?

Also, How to make ini-file for example so that I can set text-color to ini-file and the program will read and obey it on startup?

f0dder:
Forget about that color-stuff you posted, it's 16-bit junk and doesn't apply to modern times - I assume you want to do win32 console apps. Forget about writing to DLLs, it's dirty & error-prone.

RedPillow:
Got that.

But I still would like to have that read/write example with a txt-file please :]

Crush:
Outputs via DOS-interrupts is nowadays outdated and not working any more if you don´t use a VGA-Emulator like DosBox.
Here and here are some examples (at the bottom).
Additional ones are these: Here and here.
All you need is there inside. You only have to mix the file-output and text-input together - so you still have a little thing to do.

Navigation

[0] Message Index

[*] Previous page

Go to full version