[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: strange question about the io.write
- From: Kenneth Forsbäck <kenneth.forsback@...>
- Date: Thu, 19 Nov 2009 12:08:29 +0200
Different platforms use different definitions for new line.
unix/linux = LF
windows = CRLF
mac = CR
bidong liao wrote:
but why? different platforms got different results(mac got CRLF but windows
On Thu, Nov 19, 2009 at 5:38 PM, Philippe Lhoste <PhiLho@gmx.net> wrote:
On 19/11/2009 05:52, Roger Ivie wrote:
Yes. When you open in text mode, "\n" is written as CRLF instead of LF.
That's what text mode means.
In text mode, when you write "\r\n", it is written as CRCRLF. The first
CR is for the "\r" and the CRLF is for the "\n".
Aha, good answer! Obvious in retrospect... It explains why sometime I get
files with double line spacing with this curious CRCRLF scheme. And why one
should use the system-agnostic \n line ending: even if that's what is
written raw in the file, only the brain-dead Notepad won't understand it...
-- (near) Paris -- France
-- -- -- -- -- -- -- -- -- -- -- -- -- --