ListWrite Function

Action

Writes the contents of a list to a newly created file or overwrites the contents of an existing file.

Syntax

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 which to write. STRING.
ftType Specifies the format of the text file to be created. Only affects the creation of new files. FT_ANSI (the default), FT_UNICODE, or FT_UTF8.

Notes

ListWrite writes the contents of a list to a new file. Each item in lsList becomes a line in sFileName. Silk Test Classic raises exception E_FILE if sFileName cannot be created.

Example

[ ] LIST OF STRING lsFruit
[ ] ListWrite ( { "apples", "oranges" }, "fruit.txt", FT_ANSI)
[ ] ListRead (lsFruit, "fruit.txt" )
[ ] ListPrint (lsFruit)
[ ] // Prints:
[ ] // apples
[ ] // oranges