[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Two documentation suggestions
- From: Oliver Kroth <oliver.kroth@...>
- Date: Tue, 10 Nov 2020 14:26:58 +0100
This is neither a Lua nor a C thing. It is actually a peculiarity of
CP/M / MSDOS / Windows, which have two modes for reading files:
A text mode where a newline is "corrected" to CR-LF, and the end of the
file is at the first ^Z ('\x1A'),
and a binary mode where this processing is not done.
When you open a PNG file, you will by design (of the file) need binary
mode on those systems.
The documentation for `io.open` mentions opening a file in binary mode:
The mode string can also have a 'b' at the end, which is needed in some
systems to open the file in binary mode.
Perhaps this explanation is enough for someone who knows C. But as
someone who is simply a Lua user (not an embedder), this sentence is
vague. Is it possible to add more detail or is this one of the