These built-in predicates enable a single byte to be input from and output to a binary stream. -1 is returned to indicate the end-of-file.
Templates
Description
get_byte(SorA, Byte) succeeds if Byte unifies with the next byte read from the stream associated with the stream-term or alias SorA.
get_byte/1 applies to the current input stream.
Errors
SorA is a variable | instantiation_error | |
Byte is neither a variable nor an in-byte | type_error(in_byte, Byte) | |
SorA is neither a variable nor a stream-term or alias | domain_error(stream_or_alias, SorA) | |
SorA is not associated with an open stream | existence_error(stream, SorA) | |
SorA is an output stream | permission_error(input, stream, SorA) | |
SorA is associated with a text stream | permission_error(input, text_stream, SorA) | |
SorA has stream properties end_of_stream(past) and eof_action(error) | permission_error(input, past_end_of_stream, SorA) | |
Portability
ISO predicates.
Templates
Description
peek_byte(SorA, Byte) succeeds if Byte unifies with the next byte that will be read from the stream associated with the stream-term or alias SorA. The byte is not read.
peek_byte/1 applies to the current input stream.
Errors
SorA is a variable | instantiation_error | |
Byte is neither a variable nor an in-byte | type_error(in_byte, Byte) | |
SorA is neither a variable nor a stream-term or alias | domain_error(stream_or_alias, SorA) | |
SorA is not associated with an open stream | existence_error(stream, SorA) | |
SorA is an output stream | permission_error(input, stream, SorA) | |
SorA is associated with a text stream | permission_error(input, text_stream, SorA) | |
SorA has stream properties end_of_stream(past) and eof_action(error) | permission_error(input, past_end_of_stream, SorA) | |
Portability
ISO predicates.
Templates
Description
unget_byte(SorA, Byte) pushes back Byte onto the stream associated with the stream-term or alias SorA. Byte will be the next byte read by get_byte/2. The maximum number of bytes that can be successively pushed back is given by the max_unget Prolog flag (section 7.22.1).
unget_byte/1 applies to the current input stream.
Errors
SorA is a variable | instantiation_error | |
Byte is a variable | instantiation_error | |
Byte is neither a variable nor a byte | type_error(byte, Byte) | |
SorA is neither a variable nor a stream-term or alias | domain_error(stream_or_alias, SorA) | |
SorA is not associated with an open stream | existence_error(stream, SorA) | |
SorA is an output stream | permission_error(input, stream, SorA) | |
SorA is associated with a text stream | permission_error(input, text_stream, SorA) | |
Portability
GNU Prolog predicates.
Templates
Description
put_byte(SorA, Byte) writes Byte onto the stream associated with the stream-term or alias SorA.
put_byte/1 applies to the current output stream.
Errors
SorA is a variable | instantiation_error | |
Byte is a variable | instantiation_error | |
Byte is neither a variable nor a byte | type_error(byte, Byte) | |
SorA is neither a variable nor a stream-term or alias | domain_error(stream_or_alias, SorA) | |
SorA is not associated with an open stream | existence_error(stream, SorA) | |
SorA is an output stream | permission_error(output, stream, SorA) | |
SorA is associated with a text stream | permission_error(output, text_stream, SorA) | |
Portability
GNU Prolog predicates.