summaryrefslogtreecommitdiff
path: root/src/os
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2015-12-28 13:16:41 +0000
committermichi_cc <michi_cc@openttd.org>2015-12-28 13:16:41 +0000
commitbe689517f600b99eea8e564b10f14d78d1ef9bf7 (patch)
tree6eac2c9418857baf7e86e037f15b89ab7ba42517 /src/os
parent01a886d1605227a58d0231f73402fefc1579cbd9 (diff)
downloadopenttd-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/os')
-rw-r--r--src/os/windows/win32.cpp7
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" );