Writes the contents of a list to a newly created file or overwrites the contents of an existing file.
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. |
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.
[ ] LIST OF STRING lsFruit [ ] ListWrite ( { "apples", "oranges" }, "fruit.txt", FT_ANSI) [ ] ListRead (lsFruit, "fruit.txt" ) [ ] ListPrint (lsFruit) [ ] // Prints: [ ] // apples [ ] // oranges