[ ECLiPSe Stream I/O built-in.|Group Index| Full Index]

set_stream(+StreamId, +Stream)

The symbolic stream name StreamId is associated with the stream Stream.

+StreamId
Atom.
+Stream
Integer (stream number) or Atom (reserved or user-defined symbolic stream name).

Description

Assigns the logical stream StreamId to the stream Stream.

Logical streams may be matched to their physical stream numbers by using get_stream/2.

Stream can be any existing stream number or symbolic stream name as long as it has a mode compatible with that of StreamId.

StreamId can be a user-defined symbolic stream name, or else one of the system systems: input , output , error, user, toplevel_input, toplevel_output, answer_output, debug_input, debug_output.

A user-defined symbolic stream is not automatically updated when the stream to which it points is changed or closed.

Fail Conditions

None.

Resatisfiable

No.

Exceptions

(4) Instantiation fault
Either StreamId or Stream is uninstantiated.
(5) Type error
Either StreamId is not an atom or Stream is not a stream number or symbolic stream name.
(193)
Stream is an illegal stream specification.
(194)
A physical stream has more than 255 logical stream names assigned to it.

Examples


Success:
      [eclipse]: open(file1,update,s), set_stream(output,s),
      > writeln(output,hi), flush(output).
      yes.
      [eclipse]: seek(s,0), read(s,X).
      X = hi
      yes.
Error:
      set_stream(a, S).        (Error 4).
      set_stream(1.0, S).      (Error 5).
      set_stream(a, nonex).    (Error 193).


See Also

open / 4, get_stream / 2