Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create and write into text file in Lisp

I want to know, how to create and write text file in lisp. I just want to write simple line like:

"break 1"
"break 2"

I am using LispWorks IDE on Window 7

like image 236
Nilesh Pethani Avatar asked Feb 29 '12 07:02

Nilesh Pethani


1 Answers

(with-open-file (str "/.../filename.txt"
                     :direction :output
                     :if-exists :supersede
                     :if-does-not-exist :create)
  (format str "write anything ~%"))

You may also choose different settings for the with-open-file macro. If you use :append instead of :supersede then you can write into the text file while preserving its context instead of superseding the available content.

like image 186
jkt Avatar answered Sep 29 '22 20:09

jkt