lua-users home
lua-l archive

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

 On 03.10.2010 1:15, Jon Mayo wrote:
On POSIX systems you wouldn't use 'b'. But on Windows
( )
the 'b' is required for a binary mode.

In my opinion Lua programs shouldn't have to care if it is on Windows
or POSIX, so I'd call this a bug in the io library for not
interpreting the mode flags. Or alternatively I would express this as,
you can't use binary data with io.popen in a portable way because you
can't reliably pass 'b', which Windows needs.

Alternatively, *_fmode* may be set to *_O_BINARY* prior to calling fopen/popen and then returned to the previous state. Then single "r" and "w" would work the same on Windows and POSIX. Lua behavior shouldn't depend on things like _fmode.

Best regards,
Sergey Rozhenko