The function FileWriteMessage reads a message (i.e., a string) from a project tag, and then it writes that message to a text file.

Function Group Execution Windows Embedded Thin Client Mobile Access
FileWriteMessage File Synchronous Supported Supported Not supported Not supported


Web Studio Help tions file filewritemessage.xml d406761e101 FileWriteMessage
The file path and/or name of the text file. If the file is located inside your project folder, you can specify either just the file name or the file path relative to that folder. If the file is located outside your project folder, you must specify the absolute file path.
The number of bytes to skip in the text file before writing the message. To write to the start of the file, numOffset should be 0.

You can use this parameter to start reading from any position in the file, as long as you know how many bytes to skip. In most cases, you will simply take the value returned by the previous execution of this function (see “Returned value” below) and use it to resume reading where you previously stopped.

However, if you already know the structure of the file and where you want to start in it, you can do that. For example, if you know that each line of the file is exactly 100 bytes and you want to read from the start of the fifth line, numOffset should be 400.

You can also specify a value of -1, which will automatically append the message to the end of the file.

Note: The number of bytes per character in a file depends on the text encoding (i.e., ANSI, UTF-8, UTF-16, or other), the byte order, and the language or character set.
The message to be written to the text file.
A boolean value specifying whether to add a line feed (LF) to the end of the message. If this value is 1, a line feed is added. If this value is 0, a line feed is not added.

Returned value

If this function is successfully executed, it returns the position of the last byte written to the text file (including 0 if no bytes were written), which can be used in turn as the offset for the next message to be written.

If this function fails, it returns a negative value.


This function can be used to write to any plain text file, as long as the correct file extension is specified in strFilename.


  FileWriteMessage("Messages02.txt",-1,"Append this text.",0)