XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

close


Type:   -   function (subr)
Source:   -   xlfio.c

Syntax

(close file-ptr)
file-ptr - a file pointer expression
returns - NIL

Description

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

Examples

(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 XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next