reads a term from a stream.
read/1 reads from the current inputstream a single term(Term).
read/2 reads from the given stream(Stream) a single term(Term).
If the end of the stream is reached, Term will be unified with the
atom end_of_file.
Stream text input stream Term term
?- open('test.data', write, Stream),
print(Stream, [hello(world), '.']),
close(Stream).
?- open('test.data', read, Stream),
read(Stream, Term1),
read(Stream, Term2).
Term1 = hello(world)
Term2 = end_of_file
These predicates are part of the ISO-Prolog Standard.
| scroll to top |
|