TextFile_ReadLine()

Examples


The TextFile_ReadLine() function reads a line from a file opened by the TextFile_Open() function.

Syntax

TextFile_ReadLine(file_ID, return_string)

Parameters

file_ID – An integer returned by TextFile_Open() that’s used to uniquely identify this file.

return_string A string containing text (up to 255 characters) returned from the text file.

Return value

A boolean indicating a file error status; true if a file error occurred, false if no file error occurred. If an error occurs, typically it will be an end-of-file error (EOF).

Comments

When the file is opened using TextFile_Open(), you must specify that the file be opened at the beginning. The TextFile_ReadLine() function begins reading from the current position until 255 characters have been read or the end of the line is encountered. (The end of a line is indicated by a carriage return or carriage return/line feed combination of characters.) The characters read are returned to the return_string parameter. The carriage return or carriage return/line feed characters are not returned. Then, depending on whether a complete line was read, the current position is set to immediately after the end of the line or after the last character read.

To return the entire contents of a text file, you can use a loop to retrieve each line in the file until the end of the file is encountered.

[spacer]


Documentation Feedback