使用 TinyScheme。
我正在将我的代码写入文件(此处已解决 50%:How to write to a file in tinyscheme?):
(with-output-to-file "biophilia.c"
(lambda ()
(write code)
))
; and segmentation fault comes here
但它用 ""引号和\n\r 编写我的代码,所以它不会将其转换为换行符。
我需要编写看起来像 (显示代码)
以 racket docs 中的示例为例有 printf,但似乎 TinyScheme 实现没有 printf,也许我需要发现(添加它的代码)printf?
最佳答案
你可以试试:
(call-with-output-file "biophilia.c"
(lambda (port)
(write-string code port)))
假设“代码”是一个字符串。它将删除任何转义,并将其写为纯文本。
关于lisp - 如何将相似的显示(printf)写入方案中的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10909278/