Availability:built-in
[ISO]read(-Term)Read the next Prolog term from the current input stream and unify
it with Term. On reaching end-of-file Term is
unified with the atom end_of_file
. This is the same as read_term/2
using an empty option list.
[NOTE] You might have found this while looking for a predicate
to read input from a file or the user. Quite likely this is not what you
need in this case. This predicate is for reading a Prolog term
which may span multiple lines and must end in a full stop (dot
character followed by a layout character). The predicates for reading
and writing Prolog terms are particularly useful for storing Prolog data
in a file or transferring them over a network communication channel
(socket) to another Prolog process. The libraries provide a wealth of
predicates to read data in other formats. See e.g., library(readutil)
,
library(pure_input)
or libraries from the extension
packages to read XML, JSON, YAML, etc.