SYS_ListWrite Function

Action

Writes the contents of a list to a file on a target machine.

Syntax

SYS_ListWrite (lsList, sFileName, ftType)
Variable Description
lsList The text to write to a file. LIST OF STRING.
sFileName The name (and path, if necessary) of the file to write to. STRING.
ftType Specifies the format of the text file to be created. Only has an effect when creating a new file. One of FT_ANSI, FT_UNICODE, or FT_UTF8. Default is FT_ANSI.

Notes

SYS_ListWrite is executed by the Agent process, not the Silk Test Classic process; but it is essentially the same as ListWrite. 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_ListWrite writes the contents of a list to a file. Each item in lsList becomes one line in sFileName. Silk Test Classic raises the exception E_FILE if sFileName cannot be created.

You can use this function in an environment that uses the Open Agent or Classic Agent. Silk Test Classic automatically uses the appropriate Agent.

Example

LIST OF STRING lsFruit
SYS_ListWrite ( { "apples", "oranges" }, "fruit.txt" , FT_ANSI)
SYS_ListRead (lsFruit, "fruit.txt" )
ListPrint (lsFruit)
// Prints:
// apples
// oranges