[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: strange question about the io.write
- From: Roger Ivie <rivie@...>
- Date: Wed, 18 Nov 2009 20:52:49 -0800 (PST)
On Thu, 19 Nov 2009, sagasw wrote:
And you could notice the open function's parameter is "w", it means I want
to write text file.
[snip]
The CR is "\r", the LF is "\n", and they can't display in mail, so I use
string to replace.
I trace the Lua binary code generating, it seems correct.
[snip]
So my question is, why the script get incorrect(?) result in windows?
Is the issue in windows's fwrite function?
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".
--
roger ivie
rivie@ridgenet.net