SYS_FileClose Function

Action

Closes a file on the target machine.

Syntax

SYS_FileClose (hFile)
Variable Description
hFile The handle of the file to close. HFILE.

Notes

SYS_FileClose is executed by the Agent process, not the Silk Test Classic process; but it is essentially the same as FileClose. 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_FileClose closes the file identified by hFile. You return a handle to the file (an HFILE) by calling the SYS_FileOpen function.

Silk Test Classic raises the exception E_HANDLE if the file has already been closed or if an invalid file handle is specified.

This function is not designed for local access.

Example

// output file handle
HFILE OutputFileHandle
// Create and open file for writing,
// write to it, then close
OutputFileHandle = SYS_FileOpen ("mydata.txt", FM_WRITE)
SYS_FileWriteLine (OutputFileHandle, "First line of text")
SYS_FileClose (OutputFileHandle)