A file pointer to a previously opened file. This may be either a file in the file system, or a string opened for read and write.
All characters in the file up to the first newline character, as a string. If the end of file is reached, returns "Unexpected end of file".
This function reads a single line of text from the given file, up to the first newline character, regardless of Lisp syntax. This allows a programmer to deal with text files constructed by other programs.
An input file contains the following:
Lists can be
expressed as (a b c).Successive calls to read_line will produce:
Gamma> ft = open ("myreadlfile.dat", "r");
#<File:"myreadlfile.dat">
Gamma> read_line(ft);
"Lists can be"
Gamma> read_line(ft);
"expressed as (a b c)."
Gamma> read_line(ft);
"Unexpected end of file"
Gamma>
See the Common: The Text Message Display section of the Controller Functions chapter, or the GTK: Displaying Query Data section or the Photon: Displaying Query Data section of the History Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.