Code: Select all
ex = FileExists ("Data.txt")
Code: Select all
ex = FileExists ("Data.txt")
Jonez already mentioned the details of data types, so I'll just show a complete example on how to write varibale Name$ to a file:coolw wrote:How do I add data into the file?
Lets say I wanted to add a name to the file, "Name$", do I,
WriteByte
WhiteShort
WriteInt
WriteFloat
What they do would be nice, for all of them, since I will probably be using most of them.
Code: Select all
'Open a file for writing and get an handle for it into variable named f
f = OpenToWrite("testfile.txt") 'If a file exists with this name, OpenToWrite will delete it. Use OpenToEdit if you wish just to add text to an existing file.
'Write Name$ to the file we opened.
WriteLine f, Name$ 'Using WriteLine will produce text which will look fine when the file is opened in Notepad. Otherwise you could use WriteString which could be used to make savegame files etc.
'Finish the work by closing the file
CloseFile f