at_end_of_file/[0,1]

Synopsis

at_end_of_file

at_end_of_file(+Stream)

Tests whether end of file has been reached for the current input stream or for the input stream Stream.

Arguments


Stream
stream_object a valid Prolog input stream

Description

at_end_of_file/[0,1] checks if end of file has been reached for the specified input stream. An input stream reaches end of file when all characters except the file border code (-1 by default) of the stream have been read. It remains at end of file after the file border code has been read.

Exceptions

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


existence_error
Some operating system dependent error occurred in reading.

Comments

at_end_of_file/[0,1] peeks ahead for next input character if there is no character available on the buffer of the specified input stream.

Coding with at_end_of_file/[0,1] to check for end of file condition is more portable among different operating systems than checking end of file by the character code (for example, peek_char(-1)).

See Also

at_end_of_line/[0,1].