Reads a list from a file into a list variable.
ListRead (lsList, sFineName, frType)
Variable | Description |
---|---|
lsList | A variable to hold the new list. LIST OF STRING. |
sFileName | The name (and path, if necessary) of the file containing the data. STRING. |
ftType | Specifies the format of the text file to be created. Only has an effect when creating a new file. Possible values are FT_ANSI, FT_UNICODE, and FT_UTF8. The default value is FT_ANSI. |
Each line in sFileName becomes an item in lsList. ListRead interprets all lines in sFileName as strings. Each line of sFileName is returned as a string; no other type of data is returned.
ListRead modifies the lsList variable. Any previous value in lsList is discarded.
Each item in the list can be a maximum of 512 characters. Silk Test Classic raises the exception E_FILE if sFileName is not found or cannot be opened.
LIST OF STRING lsFruit ListWrite ( { "apples", "oranges" }, "fruit.txt", FT_ANSI) ListRead (lsFruit, "fruit.txt" ) ListPrint (lsFruit) //Results //apples //oranges