Substitute _CRT_fmode

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?

Substitute _CRT_fmode

Postby kosh » Fri Mar 29, 2013 2:52 am

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.
kosh
 
Posts: 69
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan

Re: Substitute _CRT_fmode

Postby Lutz » Fri Mar 29, 2013 2:48 pm

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:

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.
Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP and the O.S.

Who is online

Users browsing this forum: No registered users and 1 guest