Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Spyros on Fri 13/06/2003 21:28:34

Title: A question about the file I/O commands
Post by: Spyros on Fri 13/06/2003 21:28:34
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?
Title: Re:A question about the file I/O commands
Post by: Scorpiorus on Fri 13/06/2003 22:06:44
You could open it with FileOpen (filename, FILE_WRITE) so that if a file called filename already exists it will be overwritten.

-Cheers
Title: Re:A question about the file I/O commands
Post by: Spyros on Sat 14/06/2003 17:01:09
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
Title: Re:A question about the file I/O commands
Post by: Pumaman on Sat 14/06/2003 19:20:48
FILE_WRITE will overwrite an existing file.

FILE_APPEND will add to the end of an existing file.
Title: Re:A question about the file I/O commands
Post by: Scorpiorus on Sat 14/06/2003 20:11:59
FILE_APPEND, you say... hehe, one more undocumented feature has been discovered ;D
Title: Re:A question about the file I/O commands
Post by: Pumaman on Sat 14/06/2003 20:14:31
Ah, oops. I added it in 2.55 but must have forgotten to add it to the manual. I'll get it updated :)