FileWriteMessage() function
- Last UpdatedJul 22, 2024
- 1 minute read
Writes a specified number of bytes (or one line) of string data to a file.
Syntax
[result = ] FileWriteMessage (filename, offset, messagetag, linefeed)
Parameters
filename
Name of the file to write the data to. A literal string value, a message tagname, or a string expression.
offset
Location (in bytes) in the file to start writing to. Set it to -1 to write data to the end of the file (append). A literal integer value, integer tagname, or integer expression.
messagetag
Message tagname that contains the data to be written to the file.
linefeed
Specifies whether to write a line feed (LF) character after writing the data to the file. Set to 1 to write a line feed character; otherwise, set it to 0. A literal Boolean value, discrete tagname, or Boolean expression.
Return value
Contains the new byte position after the write. You can use this for subsequent writes to the file.
Example(s)
This script writes the value of a message tagname MsgTag to the end of the file c:\Data\File.txt.
FileWriteMessage("c:\Data\File.txt",-1,MsgTag,1);