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

From: Dave Gurnell (davegurnell at gmail.com)
Date: Wed Jan 9 08:23:10 EST 2008

Noel wrote:
> Try this:
>
> (display "\r\n")


So on Windows, (printf "~n") and (printf "\r\n") aren't equivalent?  
The documentation seems to suggest this:

   -- SNIP --

   -  ~n or ~% prints a newline

   -- SNIP --

A newline isn't necessarily a complete line break. However, this seems  
counter-intuitive to me: why have ~n at all? The documentation for ~w  
below reads:

   -- SNIP --

   -  ~w, where w is a whitespace character, skips characters in  
format-string
     until a non-whitespace character is encountered or until a second  
end-of-line
     is encountered (whichever happens first). An end-of-line is  
either #\return,
     #\newline, or #\return followed immediately by #\newline (on all  
platforms).

   -- SNIP --

which implies that ~w is platform aware. Is there call for a platform  
specific line break escape here?

-- Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20080109/6ac17043/attachment.html>

Posted on the users mailing list.