A question about the file I/O commands

Started by Spyros, Fri 13/06/2003 21:28:34

Previous topic - Next topic

Spyros

Hi, while making the BOS complete game I use some FileRead/Write commands to pass some game integers from one to another (score,total time passed, music/sound volume etc).
So after finishing BOS 1 I write a small bos1.dat file that's read in the start up function of BOS 2.
Then when finishing BOS 2 I write a bos2.dat file etc.
So I end up with bos1.dat, bos2.dat, bos3.dat.
The Question is:
Is there a way to have only one dat file?
I mean can I clear the contents of the dat before writting the new ones or delete the old dat file before writting the new one?

Scorpiorus

You could open it with FileOpen (filename, FILE_WRITE) so that if a file called filename already exists it will be overwritten.

-Cheers

Spyros

Thanks, I thought that if you do this it will just add the new data  to the file and not overwrite it , but I supose that you are right

Pumaman

FILE_WRITE will overwrite an existing file.

FILE_APPEND will add to the end of an existing file.

Scorpiorus

FILE_APPEND, you say... hehe, one more undocumented feature has been discovered ;D

Pumaman

Ah, oops. I added it in 2.55 but must have forgotten to add it to the manual. I'll get it updated :)

SMF spam blocked by CleanTalk