[ Character I/O | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]
unget(+Stream)
Back up one character on Stream
- +Stream
- Integer (stream number) or Atom (reserved or user-defined symbolic stream name).
Description
Go back one character on the given Stream. This can be used to
implement lookaheads. The number of characters that can be backed
up is guaranteed to be at least 4.
Fail Conditions
None
Resatisfiable
No.
Exceptions
- (4) instantiation fault
- Stream is not instantiated.
- (5) type error
- Stream is neither an integer nor an atom.
- (6) out of range
- No further backup possible on this stream.
Examples
% look ahead one character in Stream:
peek(Stream, X) :-
get(Stream, X),
unget(Stream).
See Also
get / 2, get_char / 2