diff options
| author | Garett Bass <garettbass@me.com> | 2021-02-13 11:48:29 -0800 |
|---|---|---|
| committer | Garett Bass <garettbass@me.com> | 2021-02-13 11:48:29 -0800 |
| commit | e4177472c8209d553135b7e61e2ccc87ec629449 (patch) | |
| tree | 79d1ed05e1a0616f19a2e98ca509af8a1ab121fa | |
| parent | 75734a45574252e1e5373dfff9ba70a33f41a620 (diff) | |
enable console output in WinMain
| -rw-r--r-- | sokol_app.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sokol_app.h b/sokol_app.h index 01159705..a0005357 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -6349,6 +6349,12 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _ _SOKOL_UNUSED(hPrevInstance); _SOKOL_UNUSED(lpCmdLine); _SOKOL_UNUSED(nCmdShow); + if (AttachConsole(ATTACH_PARENT_PROCESS)) { + freopen("CON", "r", stdin); + freopen("CON", "w", stdout); + freopen("CON", "w", stderr); + } + SetConsoleOutputCP(CP_UTF8); int argc_utf8 = 0; char** argv_utf8 = _sapp_win32_command_line_to_utf8_argv(GetCommandLineW(), &argc_utf8); sapp_desc desc = sokol_main(argc_utf8, argv_utf8); |