SaveFile

Files
Aptilis 1

SaveFile(FileName, Content)

SaveFile will simply create and open a file named FileName and write the content you specified into it. If an old file existed under the same name, it will be deleted, see AppendToFile to add things at the end of a file.
The path indicated should be constructed according to your platform.
Windows/DOS way: c:\texts\accounts\year96.txt
Unix way: /texts/accounts/year96.txt
Note the different slashes...

SaveFile can save files onto remote FTP servers using the FTP protocol. Make sure you check the internet enabled version of SaveFile in this other page!

Return Value:
Number of bytes written.
If the value is different from the length of the string you specified, then check the _errno variable for details.

Example:

saveFile("myfile.txt","Hello world\n-----------")
Result:
The file myfile.txt contains:
Hello world
-----------
See also loadfile, AppendToFile.