put/[1,2]

Synopsis

put(+Char)

put(+Stream, +Char)

Evaluates the integer expression Char, and writes the lower 8-bits to the current output stream or to Stream.

Arguments


Stream stream_object
a valid Prolog output stream
Char expr
a legal character code or an integer expression. A useful form of integer expression for this argument is a single character following 0', such as 0'a, 0'b, etc.

Description

put/[1,2] writes out the least significant 8 bits of the evaluated Char to the specified output stream unless Char is evaluated to be the line border code of the stream. The character written out is usually stored in the buffer of the stream. If the buffer overflows, it is written out to the disk. If the evaluated Char is the same as the line border code of the output stream, the operation works like nl/[0,1]. The default line border code for a text stream and a tty stream is the linefeed character (ASCII code 10).

Exceptions

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


instantiation_error
Char is not instantiated.
type_error
Char is not an integer type.
permission_error
There is an error in the bottom layer of write function of the stream.

See Also

nl/[0,1], skip_line/[0,1], open/[3,4] ref-iou