Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道,如何在 lisp 中创建和编写文本文件。我只想写简单的一行:
"break 1" "break 2"
我在 Window 7 上使用 LispWorks IDE
(with-open-file (str "/.../filename.txt" :direction :output :if-exists :supersede :if-does-not-exist :create) (format str "write anything ~%"))
您还可以为with-open-file宏选择不同的设置。如果您使用:append而不是:supersedethen 您可以写入文本文件,同时保留其上下文而不是取代可用内容。
with-open-file
:append
:supersede