This built-in clause writes a byte to the stream, the stream is altered. The output stream must be a binary stream that was opened for writing.
see also: get_byte/1 get_byte/2 peek_byte/1 peek_byte/2 prolog I/O put_byte/1
| Example | |
| put_byte(user_out, 113). | Assume there is an output stream called user_out and it has contents: 120, 66, 67, the stream is left as: 120, 66, 67, 113 |
| Exceptions | |
| Byte is a variable | an instantiation_error exception is thrown. |
| Byte is neither a variable nor a byte | a type_error(byte, Byte) is thrown |
| stream_or_alias is a variable | an instantiation_error exception is thrown |
| stream_or_alias is neither a variable nor a stream term nor an alias | a domain_error(stream_or_alias, Stream) exception is thrown, the variable Stream is assigned the incorrect stream_or_alias term |
| stream_or_alias is not associated with an open stream | an existence_error(stream, Stream) exception is thrown |
| stream_or_alias is an input stream | a permission_error(output, stream, Stream) exception is thrown |
| stream_or_alias is a text stream | a permission_error(output, text_stream, OutputStream) is thrown, the variable OutputStream is assigned the stream which was used as the output stream |