[ Character I/O | Reference Manual | Alphabetic Index ]

# tyo(+Stream, +Code)

The character represented by the integer Code is put onto the output stream Stream in raw mode.

Stream
  Stream handle or alias (atom)
Code
  Integer.

## Description

Puts the character represented by the integer character code Code (in the range 0 to 255) onto the output stream Stream in raw mode.

If the stream is a terminal, the tyo/2 output goes directly to the stream, whereas the output from put/2 is buffered first, and is only output to the stream when the output is flushed (e.g. explicitly using flush/1).

If the stream is not a terminal, tyo/2 behaves like put/2.

Character codes for the non-printable characters (i.e. control characters) are also acceptable.

### Modes and Determinism

- tyo(+, +) is det

### Exceptions

(4) instantiation fault
  Stream is not instantiated.
(4) instantiation fault
  Code is not instantiated.
(5) type error
  Stream is neither a stream handle nor an atom.
(5) type error
  Code is instantiated, but not to an integer.
(192) illegal stream mode
  Stream is not an output stream.
(193) illegal stream specification
  Stream is an illegal stream specification.

## Examples

       Success:
          ?- set_stream(screen,output),
             tyo(screen,91),tyo(screen,97),
             tyo(screen,93).
          [a]
          yes.

          ?- put(screen, 0'a), tyo(screen, 0'b),
             put(screen, 0'c), tyo(screen, 0'd).
          bdac
          yes.

          ?- write(screen,i), tyo(screen, 0'h).
          hi
          yes.

    Error:
          tyo(Stream,A).                (Error 4).
          tyo(output,a).                (Error 5).
          tyo(98.0,output).             (Error 5).
          tyo("string", A).             (Error 5).
          tyo(11,97).                   (Error 192).
          tyo(atom,97).                 (Error 193).

## See Also

tyi / 1, tyi / 2, tyo / 1