closes the stream corresponding to Stream.
stream_object, must be ground
Stream or file specification.
list of term, must be ground
A list of zero or more of the following:
Specifies whether SICStus Prolog is to close the stream
forcefully, even in the presence of errors (
true), or not
false). The latter is the default. Currently this option has no
Direction is an atom specifying the direction or directions to close.
Close only the input direction, if open.
Close only the output direction, if open.
Close all directions. This is the default.
if stream is not open in the specified direction then the call to
open/4 does nothing.
Closing a single direction is mainly useful when dealing with bidirectional streams, such as sockets.
If Stream is a stream object, then if the corresponding stream is open, it will be closed in the specified directions; otherwise, an error exception is raised.
If Stream is a file specification, the corresponding
stream will be closed in the specified directions,
provided that the file was opened by
Stream errors (see ref-iou-sfh-est), plus:
Options is not instantiated enough.
Options is not a proper list.
Options contains an invalid option.
File not opened by
Stream is neither a filename nor a stream.
In this example, foo will be closed:
see(foo), … close(foo)
However, in this example, a permission error will be raised and foo will not be closed:
open(foo, read, S), … close(foo)
close(S) should have been used.