get/[1,2]

Synopsis

get(-Char)

get(+Stream, -Char)

unifies Char with the ASCII code of the next non-layout character from Stream or the current input stream.

Arguments


Char char
integer; legal ASCII code
Stream stream_object
valid Prolog input stream

Description

Layout characters are all outside the inclusive range 33..126; this includes space, tab, linefeed, delete, and all control characters.

If there are no more non-layout characters in the stream, Char is unified with -1.

Exceptions

Stream errors (see ref-iou-sfh-est), plus:


existence_error
Trying to read beyond end of Stream

Comment

If the stream is tty, trying to read beyond the end of the stream results in resetting the input stream and trying to read the next character. By using the eof_action option of open/[3,4], it is possible to specify that it should not be an error to run off the end of a stream.

See Also

get0/[1,2], ttyget/1, prompt/[2,3], open/[3,4]