[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: strange question about the io.write
- From: sagasw <sagasw@...>
- Date: Thu, 19 Nov 2009 13:06:18 +0800
Your answer is very helpful.
On Thu, Nov 19, 2009 at 12:52 PM, Roger Ivie <firstname.lastname@example.org>
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.
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.
Yes. When you open in text mode, "\n" is written as CRLF instead of LF.
So my question is, why the script get incorrect(?) result in windows?
Is the issue in windows's fwrite function?
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".