User Tools

Function CLOSE


  • close stream &key abortresult

Arguments and Values


close closes stream. Closing a stream means that it may no longer be used in input or output operations. The act of closing a file stream ends the association between the stream and its associated file; the transaction with the file system is terminated, and input/output may no longer be performed on the stream.

If abort is true, an attempt is made to clean up any side effects of having created stream. If stream performs output to a file that was created when the stream was created, the file is deleted and any previously existing file is not superseded.

It is permissible to close an already closed stream, but in that case the result is implementation-dependent.

After stream is closed, it is still possible to perform the following query operations upon it:

The effect of close on a constructed stream is to close the argument stream only. There is no effect on the constituents of composite streams.

For a stream created with make-string-output-stream, the result of get-output-stream-string is unspecified after close.


(defparameter *S* (make-broadcast-stream))




(close *S*)


(output-stream-p *s*)


Side Effects

The stream is closed (if necessary). If abort is true and the stream is an output file stream, its associated file might be deleted.

Affected By


Exceptional Situations


See Also