Substitute _CRT_fmode

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Post Reply
Posts: 69
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan

Substitute _CRT_fmode

Post by kosh »

Hi Lutz.

in nl-filesys.c:76

Code: Select all

Set binary as default file mode for Windows.
See also
unsigned int _CRT_fmode = _O_BINARY;
This technique cannot available because of unimplemented in MinGW64.
and URL has changed to

_setmode function is available to use mingw32 and 64.

Code: Select all

#include <stdio.h>
#include <fcntl.h>
#include <io.h>
int main(...) {
#if _WIN32
        _setmode(_fileno(stdin), _O_BINARY);
        _setmode(_fileno(stdout), _O_BINARY);
        _setmode(_fileno(stderr), _O_BINARY);
Last edited by kosh on Sat Mar 30, 2013 3:37 pm, edited 1 time in total.

Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: Substitute _CRT_fmode

Post by Lutz »

Thanks for the research Kosh. I included your changes here: ... nprogress/

I have not yet made anta40's change in the other thread here: ... 264#p21264

... out-commenting the definition of _matherr, because I need to look at the handling of this in the next MinGW version first.

Post Reply