ReadLine()
Summary
Reads a string of characters from a text file.
Syntax
line = ReadLine(file fptr)
| Argument | Contents |
|---|---|
| fptr | A file handle |
Returns
A string read from the current position in the text file.
Notes
-
ReadLine() stops reading when it reaches a newline character or the end of the file.
-
The maximum size of the string read is 5119 characters. Longer strings are truncated, and the remainder is read with the next ReadLine().
Example
// Make sure the path is correct for your installation of Maptitude
fptr = OpenFile("C:\\Program Files\\Maptitude\\mtdata.txt", "r")
while not FileAtEOF(fptr) do
ShowMessage(ReadLine(fptr))
end
CloseFile(fptr)
Error Codes
| Error Type | Meaning |
|---|---|
| EndOfFile | The end of the file is encountered while reading a line |
| Error | The file is not open, the file is not open for reading, or the file is a binary file |
See Also
| Function | Summary |
|---|---|
| CloseFile() | Closes a file |
| WriteLine() | Writes a string of characters to a text file |
| ReadSizedArray() | Reads a group of strings from a file |
| OpenFile() | Opens a text or binary file on disk |