This built-in clause writes a character to the current output stream, the stream is altered. The current output stream must be a text stream that was opened for writing. It is possible to use character code constants as argument, like 0'a or 0'".
see also: get_byte/1 get_byte/2 get_char/1 get_char/2 get_code/1 get_code/2 peek_char/1 peek_char/2 peek_code/1 peek_code/2 prolog I/O put_char/2 put_code/1 put_code/2 nl/0 nl/1
| Example | |
| put_char(t). | assume the current output stream has contents: q, w, e succeeds with empty substitution and the stream is left as: q, w, e, t |
| put_char(0'a). | succeeds and writes the character 'a' to the current output stream |
| Exceptions | |
| Char is a variable | an instantiation_error is thrown |
| Char is neither a variable nor a character | a type_error(character, Char) is thrown |
| current output stream is a binary stream | a permission_error(output, binary_stream, OutputStream) is thrown, the variable OutputStream is assigned the stream which was used as output stream |