|
On 03.10.2010 1:15, Jon Mayo wrote:
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.On POSIX systems you wouldn't use 'b'. But on Windows (http://msdn.microsoft.com/en-us/library/96ayss4b%28VS.80%29.aspx ) 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.
-- Best regards, Sergey Rozhenko mailto:sergroj@mail.ru