lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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.
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