new line
Shawn Pearce
spearce@REDACTED
Tue Apr 22 08:08:00 CEST 2003
I believe it is intentional. ~n is LF, ~r is CR, and there is no
fancy difference between UNIX and Windows when it comes to how
~n is handled. Thus code can be written to be portable, if you
really wanted ~r~n for the braindead platforms that still need it,
you would have to handle that yourself.
At least that's what I think I've read on this list before. :)
I happen to like that there isn't a difference between ~n on UNIX
and Windows, makes it easy to do everything but read/write Windows
text files. And most good (aka not notepad.exe) Windows text editors
(even wordpad!) can handle UNIX text files holding just LFs. Thus I
don't usually find a need to generate "proper" CRLF Windows text files
and "proper" LF-only UNIX text files (when on UNIX) from the same code.
Chris Pressey <cpressey@REDACTED> wrote:
> In the io man page, it says "~n Writes a new line."
>
> How is a new line defined?
>
> Under Windows, when printing to a file, ASCII character 10 is all that
> prints for a ~n. (to the screen it does display a new line.) This is
> also the case for a large term passed to ~p that is printed on multiple
> lines.
>
> Is this behaviour intentional or incidental?
>
> -Chris
--
Shawn.
Pick another fortune cookie.
More information about the erlang-questions
mailing list