diff options
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/windows/win32.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 2682fa143..041468a13 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -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" ); |