[plt-scheme] Help on newline when writing to a file

From: Lian DanHui (linda.lian at gmail.com)
Date: Wed Jan 9 04:42:20 EST 2008

Hello all,

Here's the code:
(define write-to-file
  (lambda (input)
    (call-with-output-file "g:\\my\\a.txt"
    (lambda (p)
    (display input p)
     (fprintf p "~n ~a as a string is ~s." '(3 4) "(3 4)")) 'update)))

But after open a.txt, the newline is not written to the file.

I tried the following too:
 (call-with-output-file "g:\\my\\5.txt"
  (lambda (p)
    (display "aaa" p)
    (display newline p)))

And the text file is :
aaa#<primitive:newline>

How can I write a newline to a file?

thanks & regards,
Linda Lian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080109/ee957238/attachment.html>

Posted on the users mailing list.