[ Stream I/O | Reference Manual | Alphabetic Index ]

# close(+Stream, +Options)

Closes the stream specified by Stream.

Stream
  Stream handle or alias (atom)
Options
  List of option terms

## Description

The only supported option is force(true). This will suppress any errors that would have been raised during closing otherwise, in particular errors from the operating system, or the stream being already closed. It is intended for error handling routines that want to do their best to free resources.

close(Stream,[]) is equivalent to close(Stream). See close/1 for more details.

### Modes and Determinism

- close(+, +) is det

### Exceptions

(4) instantiation fault
  Stream is not instantiated.
(4) instantiation fault
  Options is not sufficiently instantiated.
(5) type error
  Stream is instantiated, but not to a stream handle or an atom.
(196) trying to modify a system stream
  Trying to close a system stream (handled by default).

## Examples

    	:- local finalization(
    		close(logstream, [force(true)])
    	    ).

## See Also

close / 1, open / 3, open / 4