The predicates below are part of the Quintus compatible stream-based I/O package. In this package streams are explicitly 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.
pipe(Command)
',
just like see/1
and tell/1. Mode
is one of read
,
write
, append
or update
. Mode append
opens the file for writing, positioning the file-pointer at the end.
Mode update
opens the file for writing, positioning the
file-pointer at the beginning of the file without truncating the file.
See also stream_position/3. Stream
is either a variable, in which case it is bound to an integer
identifying the stream, or an atom, in which case this atom will be the
stream identifier. The Options list can contain the following
options:
eof_code
makes get0/1
and friends return -1 and read/1
and friends return the atom end_of_file
. Repetitive reading
keeps yielding the same result. Action error
is like eof_code
,
but repetitive reading will raise an error. With action reset
,
Prolog will examine the file again and return more data if the file has
grown.
The option reposition
is not supported in SWI-Prolog.
All streams connected to a file may be repositioned.
/dev/null
.
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.
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
.
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.