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

function WriteTextToFile(filename, text)

function AppendTextToFile(filename, text)

Both of this functions write text to a file and return true if the operation was successful, otherwise they return false.

Also, both functions 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) while 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.


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