Substitute _CRT_fmode

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

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 http://www.mingw.org/MinGWiki/index.php/binary
*/
unsigned int _CRT_fmode = _O_BINARY;
This technique cannot available because of unimplemented in MinGW64.
and URL has changed to http://oldwiki.mingw.org/index.php/binary.

_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);
#endif
}
Regards.
Last edited by kosh on Sat Mar 30, 2013 3:37 pm, edited 1 time in total.

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

Re: Substitute _CRT_fmode

Post by Lutz »

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

http://www.newlisp.org/downloads/develo ... nprogress/

I have not yet made anta40's change in the other thread here:

http://newlispfanclub.alh.net/forum/vie ... 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