Write text to file (2 ways)

Syncplify.me AFT! actually does offer 2 distinct functions to write text to file:

function WriteTextToFile(filename, text: string): boolean
function AppendTextToFile(filename, text: string): boolean

Both of these functions write text to a file and return true if the operation was successful, otherwise they return false. Also, both functions automatically create the file if it doesn’t exist.

The main difference is that the AppendTextToFile function will append text at the end of a file (if it exists) whereas the WriteTextToFile will overwrite whatever contents are already in a file with the specified text, and all pre-existing file content will be lost.

Both functions support escaped strings, so, for example, if you want to write a sentence and then a NEWLINE special control character, you can simply add \n to the text to be written to file. String escaping follows this convention.

Example:

{
  AppendTextFile('./docs/somefile.txt', 'Hello world!\n');
}