[ Term I/O | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

read(-Term)

Succeeds if the next term from the input stream is successfully read and unified with Term.
Term
Prolog term.

Description

Used to read the next term from the input stream and unify it with Term. The term must be in Prolog term format i.e. terminated by fullstop (a period and a blank space character), neither of which are retained by Prolog.

End of file acts like fullstop. If only end of file is read, the event 190 is raised and the default handler unifies Term with the atom end_of_file.

The default action for syntax errors is to print a warning and fail.

Modes and Determinism

Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

Fail Conditions

Fails if a syntax error was detected and no term could be read

Exceptions

(190) end of file reached
End of file was encountered before reading any character.
(198) reading past the file end
Trying to read even after the error 190 was raised.

Examples

   Equivalent to read(input, Term).  (see read/2 for details).



See Also

read / 2