1
0
Fork 0

(svn r27481) -Fix: [Win32] Stdin/out/err need to be re-assigned differently if the runtime lib of MSVC2015 is used.

release/1.6
michi_cc 2015-12-28 13:16:41 +00:00
parent 01a886d160
commit be689517f6
1 changed files with 7 additions and 0 deletions

View File

@ -338,9 +338,16 @@ void CreateConsole()
return;
}
#if defined(_MSC_VER) && _MSC_VER >= 1900
freopen("CONOUT$", "a", stdout);
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "a", stderr);
#else
*stdout = *_fdopen(fd, "w");
*stdin = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_INPUT_HANDLE), _O_TEXT), "r" );
*stderr = *_fdopen(_open_osfhandle((intptr_t)GetStdHandle(STD_ERROR_HANDLE), _O_TEXT), "w" );
#endif
#else
/* open_osfhandle is not in cygwin */
*stdout = *fdopen(1, "w" );