ArcBasicDocs

WriteFile

Creates a file for writing.

WriteFile ( filename$ )

Parameters

filename$
the file to create.

Description

Creates a file for writing and gives back its handle, or 0 if it can't. A file that already exists is emptied first. Write to it with commands such as WriteLine and WriteInt, then close it with CloseFile so everything is saved.

In ArcBasic

In a game made with Create Executable, the files your program writes go in the player's own data folder, not next to the game: ~/Library/Application Support/ArcBasic Games/<game> on a Mac and %APPDATA%\ArcBasic Games\<game> on Windows. Games are often installed where they can't write, and this keeps saves working there. You don't need to change anything: use the same file names as always, and reading looks in that folder first. SystemProperty("savedir") tells you where it is.

When you run the program from the editor, files are written next to it, as usual.

See also