read_until (file, delimiters)
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.
A string of delimiter characters. "" indicates white space.
All characters in the file up to the first occurrence of any of delimiter characters, or "Unexpected end of file".
This function reads characters from the input file one at a time until it reaches any of the delimiter characters, constructing a string as it goes. Successive calls continue from the point of the previous read_until. If the end of file is reached, the function returns "Unexpected end of file".
An input file contains the following:
Lists can be expressed as (a b c).
Successive calls to read_until will produce:
Gamma> ft = open ("myreadlfile.dat","r"); #<File:"myreadlfile.dat"> Gamma> read_until(ft, "("); "Lists can be\nexpressed as " Gamma> read_until(ft,"x"); "a b c)." Gamma> read_until(ft,"y"); "Unexpected end of file" Gamma>
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.