I develop an RTS game and I make a save/load system for it.
To save, I write the datas of game types into a text file (e.g. X and Y position, etc.), but when I try read these out from the file I get some problems.
First, I make a headline in these files to avoid mix with those files what have similar extension. But I can't read out this string, because the program saves it with apostrophes and I can't read out it with apostrophes:
Code: Select all
dim file as ubyte
dim headline as string
Open "saves\gamesave.txt" For Input As #file
if headline<>str("*mygamesave*") then 'But *mygamesave* never equal with "*mygamesave*" in the file!!!
Second, how can I jump onto the next (or any other) line in the text file? It seems, the Input doesn't jump after executes its own line.
And finally, how can I list these files onto the screen? Only those files, which have similar extensions.
The file handling in FreeBasic seems to be a bit difficult for me, so all useful advices are helpful for me here.