Xbasic
FILE.READ_LINE Function
Syntax
Text_Line as C = file_pointer.Read_line()
Returns
- Text_LineCharacter
Returns a line of text. A line is marked by a CR-LF.
Description
Read a line from the file.
Discussion
The .READ_LINE() method retrieves text data from the current file offset to the end of the line (marked by a carriage return and line feed ). The file from which data is read is specified by the file object pointer. The .READ_LINE() method returns a string of input characters, not including the and codes.
Example
This script will view the contents of a text file.
filename = UI_GET_FILE("Choose File", "Text File (*.txt)", "c:\a5\data\variable.txt", "X") if (filename = "") then end end if file_pointer = FILE.open(filename, FILE_RO_SHARED) while .NOT. file_pointer.eof() text = file_pointer.read_line() trace.writeln(text) end while file_pointer.close()
See Also