type: function (subr) location: built-in source file: xlfio.c Common LISP compatible: similar supported on: all machines
(close <file-ptr> ) <file-ptr> - a file pointer expression
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 ; create MYFILE (open 'mine :direction :output)) ; (print "hi" myfile) ; returns "hi" (close myfile) ; returns NIL ; file contains <hi> <NL> (setq myfile ; open MYFILE for input (open 'mine :direction :input)) ; (read myfile) ; returns "hi" (close myfile) ; returns NIL
COMMON LISP COMPATIBILITY: Common LISP has an XLISP compatible CLOSE function. Common LISP does support an :ABORT keyword, which is not supported in XLISP.