EMA-XPS Online



syntax: (with-open-file
             ; Common Lisp: This function realises
                            in- and output!
                (<stream-var> <filename>        
                [{<options> ...}])              
                [{<declaration> ...}]           
                [{<form> ...}])
             ; Babylon Lisp
                (<stream-var> <filename>)
                {<form> ...})
             ; Babylon Lisp
                (<stream-var> <filename>
                {<form> ...})

This function opens a file with the name <filename>
for reading or writing. If the file can not be opened,
then NIL will be returned.

examples:      >(with-open-file (f "test.temp"
                       :direction :output)
                       (print '(1 2 3 4 5) f)
                       (format f "~%abc"))

               >(with-open-file (f "test.temp"
                       :direction :input)
                             (list (read f)
                             (read-line f
                             (read f 'end)
                             (read-line f 'end2)))
               ((1 2 3 4 5) " " ABC END2)

In this example:       A file with the name
                        "test.temp" is made and
                       (1 2 3 4 5)

                       is written into this file!

EMA-XPS Online