| reads from a stream a single character.
get_char(-Char)
get_char(+Stream, -Char)
get_char/1 reads a single character from the current
input stream.
get_char/2 reads a single character from the stream named
in the first argument.
get_char reads the character at the current stream position
and unifies it with Char. If the stream position is behind
the end of stream,
Char will be unified with the atom end_of_file.
Arguments
Stream text input stream
Char character or end_of_file
Examples
Assume the content of a stream S is abcdefg and the
stream position is at the 1st character.
| get_char(S, 'a'). |
Succeeds. The stream position will be advanced by one character. |
| get_char('d'). |
Fails. The stream position will be advanced by one character. |
Standard
These predicates are part of the ISO-Prolog Standard.
See also
get_code/1/2,
peek_char/1/2,
peek_code/1/2,
put_char/1/2,
put_code/1/2,
nl/0/1,
set_input/1,
current_input/1.
|