Next: Explicit Input and
Up: Input and Output
Previous: Input and Output
The package for implicit input and output destination is upwards
compatible to DEC-10 and C-Prolog. The reading and writing predicates
refer to resp. the current input- and output stream. Initially these
streams are connected to the terminal. The current output stream is
changed using tell/1 or append/1. The current input stream is changed
using see/1. The stream's current value can be obtained using telling/1
for output- and seeing/1 for input streams. The table below shows the
valid stream specifications. The reserved names user_input
,
user_output
and user_error
are for neat integration with
the explicit streams.

Source and destination are either a file, one of the reserved words
above, or a term `pipe( Command)'. In the predicate descriptions
below we will call the source/destination argument ` SrcDest'.
Below are some examples of source/destination specifications.

Another example of using the pipe/1 construct is shown on in
figure
. Note that the pipe/1 construct is not part of
Prolog's standard I/O reportoire.
Figure: Get the working directory
- see( +SrcDest)
Make SrcDest the current input stream. If SrcDest was already opened for
reading with see/1 and has not been closed since, reading will be
resumed. Otherwise SrcDest will be opened and the file pointer is
positioned at the start of the file.
- tell( +SrcDest)
Make SrcDest the current output stream. If SrcDest was already opened for
writing with tell/1 or append/1 and has not been closed since, writing
will be resumed. Otherwise the file is created or --when existing--
truncated. See also append/1.
- append( +File)
Similar to tell/1, but positions the file pointer at the end of File
rather than truncating an existing file. The pipe construct is not
accepted by this predicate.
- seeing( ?SrcDest)
Unify the name of the current input stream with SrcDest.
- telling( ?SrcDest)
Unify the name of the current output stream with SrcDest.
- seen
Close the current input stream. The new input stream becomes
user.
- told
Close the current output stream. The new output stream becomes
user.
Next: Explicit Input and
Up: Input and Output
Previous: Input and Output
Passani Luca
Tue Nov 14 08:58:33 MET 1995