How to create and write to a text file in Lisp

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

"break 1" "break 2" 

I am using the LispWorks IDE in window 7

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

You can also select various settings for the with-open-file macro. If you use :append instead of :supersede , then you can write to a text file while maintaining its context instead of replacing the available content.

+12
source

Source: https://habr.com/ru/post/909610/


All Articles