The 'close' function closes the file specified through 'file-ptr'. If the file close was successful, then a NIL is returned as the result. For the file close to be successful, the 'file-ptr' has to point to a valid file. If the file close was not successful, an error is generated:
error: file not open
(close (open 'f :direction :output)) ; returns NIL (setq myfile (open 'mine :direction :output)) ; create MYFILE (print "hi" myfile) ; returns "hi" (close myfile) ; returns NIL ; file contains <hi> <NEWLINE> (setq myfile (open 'mine :direction :input)) ; open MYFILE for input (read myfile) ; returns "hi" (close myfile) ; returns NIL
Common Lisp: Common LISP has an XLISP compatible 'close' function. Common LISP does support an ':abort' keyword, which is not supported in XLISP.
See the
close
function in the