[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Cross-platform newlines in multiline strings
- From: RLake@...
- Date: Tue, 6 Apr 2004 00:32:18 +0100
Aaron, referring to \n\r\n\r (I think):
> ... although as I said that possibility isn't
as
> important since it "can't happen" in a proper text file.
Sure it can. If you have a system where <cr>
is the end of line character (such as Mac OS <10), then the C compiler
defines \n as <cr> and \r as <lf>. Then when you read a DOS/Windows
text file, you see \n\r in between the lines. (On OS/390, apparently, "/n"
means 0x85, otherwise known as "NEL". See http://www.w3.org/TR/2001/NOTE-newline-20010314)
(and anyone doing socket programming out there, please
remember that most IETF protocols use "\13\10" as a line terminator,
*not* "\r\n"; "\r\n" varies depending on platform.)
R.