read_line

read_line — reads a single line of text.

Syntax

read_line (file)

		

Arguments

file

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.

Returns

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".

Description

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.

Example

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 Also

read, read_char, read_double, read_float, read_long, read_short, read_until