lua-users home
lua-l archive

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


Mitchell:

On Thu, 24 Mar 2022 at 15:39, Mitchell <lists@triplequasar.com> wrote:
> I don't have a Windows box to test this on, but if I recall correctly, opening the file in binary mode on Windows should allow 'l' to also trim '\r'. I could be misremembering though.

It is the other way round. Opening a file in binary gives you
uninterpreted bytes. The C runtime ( on which lua builds ) is supposed
to translate whatever you os uses for end of line into a '\n'. So a
file "ab\012bc\015de\015\012" is read the same in every OS in binary
mode, but you may have problems (CP/M like CRLF, unixlike LF or
Macintosh(classic, not osx) CR ).
In default (text) mode they could be read differently. Also, normally
it is not a good idea to use binary mode for text files, or viceversa.

Francisco Olarte.






>
> Cheers,
> Mitchell