read (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.
This function reads one Lisp expression from the given file. The file must have been opened before this call with the open or open_string functions. White space and newline characters are ignored during a read. If the end of file is reached during the read call, the message "Unexpected end of file" is returned. read does not evaluate the expressions it reads.
The file "myreadfile.dat" contains the following:
(a b (c d e))
"A message" (+ 2 3)
Successive calls to read will produce:
Gamma> fp = open ("myreadfile.dat", "r"); #<File:"myreadfile.dat"> Gamma> read (fp); (a b (c d e)) Gamma> read (fp); "A message" Gamma> read (fp); (+ 2 3) Gamma> read (fp); "Unexpected end of file" Gamma>
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.