EMA-XPS Online


WITH-OPEN-INPUT-FILE

WITH-OPEN-INPUT-FILE
====================

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

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

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

               >(with-open-input-file (f "test.temp")
                    (list (read-form f)
                         (read-one-line f
                              'has-to-be-a-line)
                             (read-form f 'end)
                             (read-one-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)
                       abc

                       is written into this file!


EMA-XPS Online