see/1

Synopsis

see(+FileOrStream)

Makes file FileOrStream the current input stream.

Arguments


FileOrStream file_spec or stream_object
File specification or stream object.

Description

If there is an open input stream associated with FileOrStream, and that stream was opened by see/1, then it is made the current input stream;

Otherwise, the specified file is opened for input and made the current input stream. If it is not possible to open the file, see/1 raises an exception.

Different file names (that is, names that do not unify) represent different streams (even if they correspond to the same file). Therefore, assuming food and ./food represent the same file, the following sequence will open two streams, both connected to the same file.

     see(food)
     ...
     see('./food')
     

It is important to remember to close streams when you have finished with them. Use seen/0 or close/1.

Exceptions


instantiation_error
FileOrStream is not instantiated enough.
existence_error
FileOrStream not currently open for input, and fileerrors flag is on.
domain_error
FileOrStream is neither a filename nor a stream.

See Also

seen/0, close/1, abort/0, seeing/1 ref-iou-sfh-opn