; demonstrates how to create a new file and write to it ; ----------------------------------------------------- ; ----------------------------------------------------- ; use make-pathname for portability (setf path (make-pathname :name "hooray.txt")) ; open the file for writing (output), create a new one (supersede) (setf outputfile (open path :direction :output :if-exists :supersede)) ; print out to the file (format outputfile "Hello World~%") ; close the file (close outputfile) ; demonstrates how to open a file and read from it ; ----------------------------------------------------- ; ----------------------------------------------------- (setf inputfile (open path :direction :input)) (read-line inputfile) (close inputfile)