ReadFileLines Procedure
Reads the contents of a file as a list of strings.
Each line in the file is one string in the list.
Use
WriteFileLines to write a list of strings to a file.
Declaration
function ReadFileLines(filePath as String) as List of String
Parameters
- filePath as String — Path and filename.
Return value
List of String — The contents of the file, one string per line.
Possible error codes
- ERR_ACCESS_DENIED
- ERR_FILE_NOT_FOUND
- ERR_IO_FAILURE
- ERR_PATH_IS_DIRECTORY
- ERR_PATH_TOO_LONG
Example
Code
WriteFileText "myfile.txt", "A" + NewLine + "B" + NewLine
dim lines = ReadFileLines("myfile.txt")
print Len(lines)
print lines(0)
print lines(1)
Output