On Mon, Sep 14, 2009 at 5:11 PM, Marius Storm-Olsen <mstormo@xxxxxxxxx> wrote: > On Windows, binary files must be opened using the O_BINARY flag for > untranslated mode. MinGW does this for us automatically, but Microsoft > Visual C++ does not. Wouldn't it be better to set explicitly set _fmode = _O_BINARY when _MSC_VER is defined? _CRT_fmode is mingw specific, that in addition to setting _fmode also sets mode on stdin/stdout/stderr (see http://www.koders.com/c/fid2B507DE94598397757D615EDF52267578AD838A2.aspx). Current patch will not set binary mode for files opened with fopen, as well as stdin/stdout/stderr. One catch might be that declaring it like "unsigned int _fmode = _O_BINARY" might not work, it seems that you are supposed to set it somewhere in the code (see http://msdn.microsoft.com/en-us/library/ee2849wt(VS.80).aspx). Perhaps implementing a function like _mingw32_init_fmode in crc1.c in mingw-runtime and calling it early in main() would be better? Thanks, Alexey. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html