put(@stream_or_alias, +character)

This built-in clause writes a character to the stream, the stream is altered. The output stream must be a text stream that was opened for writing.

This predicate is not part of the ISO Prolog standard, put_char/2 is equivalent to this predicate and defined by the ISO Prolog standard. If the parameter @stream_or_alias is 'user' then the character is written to the current output stream.

see also: 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/1 put_code/1 put_code/2 nl/0 nl/1

Example
put(user, t). Assume there is an output stream called user_out and it has contents: q, w, e, the stream is left as: q, w, e, t

 

Exceptions  
Char is a variable an instantiation_error exception is thrown.
Char is neither a variable nor a character a type_error(character, Char) 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 binary stream a permission_error(output, binary_stream, OutputStream) is thrown, the variable OutputStream is assigned the stream which was used as the output stream

 

 

info@trinc-prolog.com