Writes a string to a specified ASCII or Unicode file. If the file doesn't exist, then the function will create the file.
Function | Group | Execution | Windows | Embedded | Thin Client |
---|---|---|---|---|---|
FileWrite | File | Synchronous | Supported | Supported | Supported |
Writes a string to a specified ASCII or Unicode file. If the file doesn't exist, then the function will create the file.
By default, the file will be written in your project folder (i.e., the folder that contains the file project_name.APP). To write in another folder, specify the complete file path.
Value | Description |
---|---|
0 | Creates a new ASCII file with the given file name. If the file already exists, then it is overwritten. |
1 | Appends to an existing ASCII file with the given file name. If the file doesn't exist, then a new file is created. |
2 | Creates a new Unicode (UTF-16LE) file with the given file name. If the file already exists, then it is overwritten. |
3 | Appends to an existing Unicode file with the given file name. If the file doesn't exist, then a new file is created. |
This is an optional parameter. If any value other than 0 through 3 is given, or if the parameter is not used, then 0 is the default.
0 | Successful execution. |
−1 | Invalid parameter(s). |
−2 | Failed to open file. Disk is write protected or file name is invalid. |
Tag Name | Expression |
---|---|
Tag | FileWrite( "c: est.txt", "This is a test" ) |
Tag | FileWrite( strFileName, strWriteText ) |
Tag | FileWrite( strFileName, strWriteText, 1 ) |