[ ECLiPSe Stream I/O built-in.|Group Index|
Full Index]
get_stream(+StreamId, ?Stream)
Succeeds if Stream is the stream to which the stream StreamId is assigned.
- +StreamId
- Atom or integer.
- ?Stream
- Integer, atom or variable.
Description
StreamId is an existing logical or physical stream. If Stream is a
variable, then it is bound to the physical stream number corresponding
to StreamId. Otherwise, the predicate succeeds if StreamId denotes the
same stream as the symbolic stream name or physical stream number
Stream.
The predefined logical system stream names are:
input, output, error, toplevel_input, toplevel_output, answer_output,
null, debug_input and debug_output.
Fail Conditions
Fails if Stream is not a stream with the stream identifier StreamId.
Resatisfiable
No.
Exceptions
- (4) Instantiation fault
- One or both of StreamId and Stream is not instantiated.
- (5) Type error
- Stream is neither an atom, an integer nor a variable.
- (5) Type error
- StreamId is neither an atom nor an integer.
- (193)
- StreamId is an illegal stream specification.
Examples
Success:
[eclipse]: get_stream(input,X), set_stream(a,input),
> get_stream(input,a).
X = 0
yes.
Fail:
set_stream(b,4), get_stream(b, 10).
Error:
get_stream(Id, S). (Error 4).
get_stream(1.0,S). (Error 5).
get_stream(3, S). (Error 5).
get_stream(blah,S). (Error 193). % does not exist
See Also
set_stream / 2