Writes a line of text to a file on the target machine.
SYS_FileWriteLine (hFile, sLine)
Variable | Description |
---|---|
hFile | The handle of the file to write to. HFILE. |
sLine | The text to write. STRING. |
SYS_FileWriteLine is executed by the Agent process, not the Silk Test Classic process; but it is essentially the same as FileWriteLine. To affect the host process, use the function with the hHost notation or machine handle operator. For more information about the machine handle operator and hHost, see Machine handle operator.
SYS_FileWriteLine writes the specified string to the file identified by hFile. It automatically appends the appropriate character or characters (for example, a carriage return/line feed sequence) needed to delimit a line of text on the current platform.
You can get a handle to a file (an HFILE) by calling the SYS_FileOpen function with the filemode data type set to either FM_WRITE, FM_UPDATE, or FM_APPEND.
The File functions that control writing to a file do not test your accessibility to a file. This means that you cannot write information to a file that has been opened in read only mode with FileOpen(). The function will successfully return, but no information is actually written to the file. There is no error message that indicates this.
This function is not designed for local access.
HFILE FileHandle // Open file, append line, and close FileHandle = SYS_FileOpen ("mydata.txt", FM_APPEND) SYS_FileWriteLine (FileHandle, "next line of text") SYS_FileClose (FileHandle)