aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/main.cpp
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2018-12-12 15:18:43 +0100
committerStapleButter <thetotalworm@gmail.com>2018-12-12 15:18:43 +0100
commit24d6bd27866648aaf02d4a6fbbcf68c208712180 (patch)
tree614661ae7df00f0a0cfaa99d147f92eaef1bfd43 /src/libui_sdl/main.cpp
parentaffe1c084f910f3e24befbc35540566a466c34fd (diff)
send console output to parent process's console.
this way Windows release builds can get console output if run from cmd.exe, just like under Linux
Diffstat (limited to 'src/libui_sdl/main.cpp')
-rw-r--r--src/libui_sdl/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 1a2cc6f..d620d4d 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -1666,8 +1666,17 @@ int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdsho
if (res != len) { delete[] argv[i]; argv[i] = nullarg; }
}
+ if (AttachConsole(ATTACH_PARENT_PROCESS))
+ {
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ printf("\n");
+ }
+
int ret = main(argc, argv);
+ printf("\n\n>");
+
for (int i = 0; i < argc; i++) if (argv[i] != nullarg) delete[] argv[i];
delete[] argv;