\(\text{FileOpenWrite}\)

You can use the \(\text{FileOpenWrite}\) function to open a file for both reading and writing, preserving existing content. By default, new content will be appended to the end of the file.

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

The following variants of this function are available:

  • \(\text{integer } \text{FileOpenWrite} \left ( \text{<filename>} \right )\)

  • \(\text{integer } \text{FileOpenWrite} \left ( \text{<filename>}, \text{<binary>} \right )\)

The \(\text{<filename>}\) parameter is a text string encoded in a tuple holding the name of the file to be opened. If provided, the \(\text{<binary>}\) parameter indicates if the file should be written in a binary or text format. If the \(\text{<binary>}\) is not included, Aion will assume a text file. Note that the \(\text{<binary>}\) parameter is only meaningful on Windows and modifies how the several control codes are interpreted.

On success, the \(\text{FileOpenWrite}\) function returns a file number you can then use to interact with the file using any of the functions:

When you are done, you should close the file using the FileClose.

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

../_images/file_modify_example.png

Figure 135 Example Use Of The FileOpenWrite Function