O_BINARY

I discovered that my www-lib .exe file, built under Cygwin, was behaving
differently depending on whether it was launched from Cygwin or from a
DOS prompt.  I discovered that the discrepancy was because it was
opening the files as text, even though the naming of the constants
indicated that it was supposed to be opening in binary mode (I assume
that's what "FB" means, in contrast to "FT").

It appeared to be fixed via the following changes to HTLocal.h:

<- #define HT_FB_RDONLY	O_RDONLY
-> #define HT_FB_RDONLY	O_RDONLY|O_BINARY
   #define HT_FT_RDONLY	HT_FB_RDONLY
   
<- #define HT_FB_WRONLY	O_WRONLY|O_CREAT
-> #define HT_FB_WRONLY	O_WRONLY|O_CREAT|O_BINARY
   #define HT_FT_WRONLY	HT_FB_WRONLY
   
<- #define HT_FB_RDWR	O_RDWR
-> #define HT_FB_RDWR	O_RDWR|O_BINARY
   #define HT_FT_RDWR	HT_FB_RDWR
   
<- #define HT_FB_APPEND	O_APPEND
-> #define HT_FB_APPEND	O_APPEND|O_BINARY
   #define HT_FT_APPEND	HT_FB_APPEND

Thanks
Max

Received on Thursday, 17 October 2002 20:42:22 UTC