next up previous contents index
Next: Character I/O Up: Input and Output Previous: Input and Output   Contents   Index

File Handling

see(+F)

Makes file F the current input stream. Also note that different file names (that is, names which do not unify) represent different input streams (even if these different file names correspond to the same file).

Exceptions:

permission_error
File F is directory or file is not readable.
instantiation_error
F is not instantiated at the time of call.
existence_error
File F does not exist.

seeing(?F)

F is unified with the name of the current input stream. This is exactly the same with predicate current_input/1 described in section 6.9, and it is only provided for upwards compatibility reasons.

seen

Closes the current input stream. Current input reverts to ``userin'' (the standard input stream).

tell(+F)

Makes file F the current output stream.

Also note that different file names (that is, names which do not unify) represent different output streams (even if these different file names correspond to the same file).

Exceptions:

permission_error
File F does not have write permission, or is a directory.
instantiation_error
F is uninstantiated.

telling(?F)

F is unified with the name of the current output stream. This predicate is exactly the same with predicate current_output/1 described in section 6.9, and it is only provided for upwards compatibility reasons.

told

Closes the current output stream. Current output stream reverts to ``userout'' (the standard output stream).

open(+File,+Mode,-Stream)

open/1 creates a stream for the file designated in File, and binds Stream to a structure representing that stream. Mode can be one of either read to create an input stream or write or append to create an output stream. If the mode is write, the contents of File are removed and File becomes a record of the output stream. If the mode is append the output stream is appended to the contents of File.

Exceptions ( read mode)

permission_error
File F is directory or file is not readable.
instantiation_error
F is not instantiated at the time of call.
existence_error
File F does not exist.

Exceptions ( write mode)

permission_error
File F does not have write permission, or is a directory.
instantiation_error
F is uninstantiated.

close(+Stream)

close/1 closes the stream Stream.

file_exists(+F)

Succeeds if file F exists. F must be instantiated to an atom at the time of the call, or an error message is displayed on the standard error stream and the predicate aborts.

Exceptions:

instantiation_error
F is uninstantiated.


next up previous contents index
Next: Character I/O Up: Input and Output Previous: Input and Output   Contents   Index
Baoqiu Cui
2000-04-23