SYS_GetFileContents Function


Returns the contents of the specified file on the target machine.


lsContents = SYS_GetFileContents (sFileName)
Variable Description
lsContents A variable to hold the new list. LIST OF STRING.
sFileName The name (and path, if necessary) of the file containing the data. STRING.


SYS_GetFileContents is similar to the SYS_ListRead, except that it by default reads the specified file on the target machine. This function is useful when doing distributed testing.

A basic difference between the two functions is that SYS_ListRead reads and transfers information one line at a time from the Agent, while SYS_GetFileContents transfers the whole file at once. If your network has difficulty with large data packets, use SYS_ListRead rather than SYS_GetFileContents.

SYS_GetFileContents is executed by the Agent process, not the Silk Test Classic process. 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.


HMACHINE target_machine // target computer
STRING sTarget // target's network name
// connect to target and save its handle
target_machine = Connect (sTarget)
lsNames = SYS_GetFileContents ("empnames.txt")
ListPrint (empnames.txt)