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

display(+Stream, ?Term)

Term is displayed on the output stream Stream --- without considering operator definitions.
Stream
Integer (stream number) or Atom (reserved or user-defined symbolic stream name).
Term
Prolog term.

Description

Used to display an expression in standard parenthesised prefix notation, onto the output stream Stream.

Note that as usual, the output is buffered, so it may need to be flushed either by closing the stream, by writing again or by using flush/1.

Modes and Determinism

Exceptions

(4) instantiation fault
Stream is not instantiated.
(5) type error
Stream is not an atom or an integer.
(192) illegal stream mode
Stream is not an output stream.
(193) illegal stream specification
Stream is an illegal stream specification.

Examples

Success:
      display(output, 3.0).                % displays 3.0
      set_stream(a,output), display(a,hi). % displays hi

      [eclipse]: open(file1,update,S), display(S, X+2), close(S).
      X = _72
      S = 6
      yes.
      [eclipse]: sh('cat file1').
      +(_98, 2)
      yes.
Error:
      display(S, a(b,c)).        (Error 4).
      display("string", a(b,c)). (Error 5).
      display(9, X=2).           (Error 192). % stream not open
      display(atom, X=2).        (Error 193).



See Also

display / 1, write / 1, write / 2