使用 R5RS 方案在文件中写入换行符

发布于 2024-10-02 11:43:20 字数 152 浏览 0 评论 0原文

我一直在寻找一种在文件中写入换行符的方法 我必须使用 R5RS,我在上一个问题(换行端口)中看到,但这在这个版本中不起作用,\n 也不起作用,

有什么想法吗?

一切都写在一行中 (写“你好”p) (写“w”p)

给我一个带有hellop的文件

I've been looking for a way to write a newline in a file
I have to use R5RS, I saw in a previous question (newline port) but this doesn't work in this version, neither does the \n,

any ideas?

everything is being written in a single line
(write "hello" p)
(write "w" p)

gives me a file with hellop

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不爱素颜 2024-10-09 11:43:20

如果您的 I/O 函数不允许您指定端口,您可以使用 with-output-to-file 来代替:

(with-output-to-file "test.out"
  (lambda ()
    (display "Hello, world!")
    (newline)))

If your I/O functions don't allow you to specify a port, you may be able to use with-output-to-file instead:

(with-output-to-file "test.out"
  (lambda ()
    (display "Hello, world!")
    (newline)))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文