diff options
author | michi_cc <michi_cc@openttd.org> | 2015-12-28 13:16:41 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2015-12-28 13:16:41 +0000 |
commit | be689517f600b99eea8e564b10f14d78d1ef9bf7 (patch) | |
tree | 6eac2c9418857baf7e86e037f15b89ab7ba42517 /src | |
parent | 01a886d1605227a58d0231f73402fefc1579cbd9 (diff) | |
download | openttd-be689517f600b99eea8e564b10f14d78d1ef9bf7.tar.xz |
(svn r27481) -Fix: [Win32] Stdin/out/err need to be re-assigned differently if the runtime lib of MSVC2015 is used.
Diffstat (limited to 'src')
-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" ); |