| retrieve the character at the current stream position.
peek_char(?Char)
peek_char(+Stream, ?Char)
peek_char/1 retrieves the character at the stream position of the current input stream.
peek_char/2 retrieves the character at the stream position of the stream Stream.
The stream position will not be altered by these predicates.
peek_char retrieves the character at the current stream position and
unifies it with Char. If the stream position is behind the end
of the inputstream,
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.
| peek_char('a'). |
Succeeds. The stream position will not be altered. |
| peek_char(C). |
Succeeds with substitution(C<-'a'). The stream position will not be altered. |
Standard
These predicates are part of the ISO-Prolog Standard.
See also
get_char/1/2,
get_code/1/2,
peek_code/1/2,
put_char/1/2,
put_code/1/2,
nl/0/1,
set_input/1,
current_input/1.
|