Solution
It is possible to append a line of text at the end of a file without reading the whole text file by using the
Set File Position function found on the Functions palette under Programming >> File I/O >> Advanced File Functions. This function allows you to set the cursor to either the start, the end or to a user-specified point in the file. This function should be placed between the
Open/Create/Replace function and the Write Text File function or Write Binary File functions using the same refnums. This works for both LabVIEW and LabVIEW NXG.
The resulting code should look like the one below when appending data to a text file:
Note: Adding data at the beginning of a file or pre-pending (as opposed to appending) without reading the original file is not a supported operation. The file already has pre-allocated memory space so for a prepend to occur all the existing data would need to be shifted down in memory so you need to read all the data and re-write it. It is possible though to write at the beginning of a file by setting the position of the current file mark at the beginning of the file but this will overwrite the first bytes of it when using the write to text file function.