Next: Switching Between Implicit
Up: Input and Output
Previous: Input and Output
The predicates below are part of the Quintus compatible stream-based
I/O package. In this package streams are explicitely created using the
predicate open/3. The resulting stream identifier is then passed as a
parameter to the reading and writing predicates to specify the source
or destination of the data.
- open( +SrcDest, +Mode, ?Stream)
SrcDest is either an atom, specifying a Unix file, or a term
`pipe( Command)', just like see/1 and tell/1. Mode is one
of read
, write
or append
. Stream is either a
variable, in which case it is bound to a small integer identifying the
stream, or an atom, in which case this atom will be the stream
indentifier. In the latter case the atom cannot be an already existing
stream identifier. Examples:

- open_null_stream( ?Stream)
On Unix systems, this is equivalent to open('/dev/null', write,
Stream)
. Characters written to this stream are lost, but the stream
information (see character_count/2, etc.) is maintained.
- close( +Stream)
Close the specified stream. If Stream is not open an error
message is displayed. If the closed stream is the current input or
output stream the terminal is made the current input or output.
- current_stream( ?File, ?Mode, ?Stream)
Is true if a stream with file specification File, mode Mode
and stream identifier Stream is open. The reserved streams
user and user_error are not generated by this predicate. If a
stream has been opened with mode append
this predicate will
generate mode write.
- stream_position( +Stream, -Old, +New)
Unify the position parameters of Stream with Old and set them to
New. A position is represented by the following term:
'$stream_position'(CharNo, LineNo, LinePos).
It is only possible to change the position parameters if the stream is
connected to a disk file. If the position is changed, the CharNo
field determines the new position in the file. The LineNo and
LinePos are copied in the stream administration.
Next: Switching Between Implicit
Up: Input and Output
Previous: Input and Output
Passani Luca
Tue Nov 14 08:58:33 MET 1995