You can use the \(\text{FileWriteString}\) function to write a string to a file.

You can use the \filewritestring backslash command to insert this function.

The following variants of this function are available:

  • \(\text{boolean } \text{FileWriteString} \left ( \text{<file number>}, \text{<string>} \right )\)

  • \(\text{boolean } \text{FileWriteString} \left ( \text{<file number>}, \text{<string>}, \text{<include new-line>} \right )\)

The \(\text{<file number>}\) parameter is an integer value returned by the \(\text{FileOpenWrite}\) or \(\text{FileOpenWriteTruncate}\) functions. The \(\text{<string>}\) parameter holds a text string encoded as a tuple. The \(\text{include new-line}\) parameter, if provided, is a boolean value holding true if the written string should be terminated with a new-line.

The \(\text{FileWriteString}\) function returns true on success or false on failure.

The Figure 139 shows how you can use the \(\text{FileWiteString}\) function.