Substitute _CRT_fmode

Started by kosh, March 28, 2013, 07:52:09 PM

Previous topic - Next topic

kosh

Hi Lutz.



in nl-filesys.c:76
/*
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">//http://oldwiki.mingw.org/index.php/binary.



_setmode function is available to use mingw32 and 64.


#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.

Lutz

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



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



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



http://newlispfanclub.alh.net/forum/viewtopic.php?f=17&p=21264#p21264">http://newlispfanclub.alh.net/forum/vie ... 264#p21264">http://newlispfanclub.alh.net/forum/viewtopic.php?f=17&p=21264#p21264



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