Nil*_*ani 6 lisp file-io file common-lisp lispworks
我想知道,如何在lisp中创建和编写文本文件.我只想写简单的行:
"break 1"
"break 2"
Run Code Online (Sandbox Code Playgroud)
我在Window 7上使用LispWorks IDE
YBE*_*YBE 14
(with-open-file (str "/.../filename.txt"
:direction :output
:if-exists :supersede
:if-does-not-exist :create)
(format str "write anything ~%"))
Run Code Online (Sandbox Code Playgroud)
您也可以为with-open-file宏选择不同的设置.如果您使用:append而不是:supersede那么您可以在保留其上下文的同时写入文本文件,而不是取代可用内容.