lua-users home
lua-l archive

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


got it. thanks for your elaborations. will remember this pratical "bottom line",

Bottom line: open files in text mode (the default) and output only \n,
never \r. If you want to generate a specific byte sequence, then you need
to open the file in binary mode for writing.

On Thu, Nov 19, 2009 at 9:36 PM, Philippe Lhoste <PhiLho@gmx.net> wrote:
On 19/11/2009 11:08, Kenneth Forsbäck wrote:
Different platforms use different definitions for new line.

unix/linux = LF
windows = CRLF
mac = CR

To be exact, pre-OS X Macs use CR only. AFAIK, MacOS X uses LF like all Unix systems.


bidong liao wrote:
but why? different platforms got different results(mac got CRLF but windows
got CRCRLF)?

Because on systems with LF as line ending, CR is kept as is, LF is converted to system's line ending, ie. LF...

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --