Skip to content

Commit

Permalink
Disable _O_WTEXT when using main in MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
asctime committed Jun 16, 2023
1 parent 602c748 commit 5dc35d3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,11 @@ void console_init(console_state & con_st) {
HANDLE hConIn = GetStdHandle(STD_INPUT_HANDLE);
if (hConIn != INVALID_HANDLE_VALUE && GetConsoleMode(hConIn, &dwMode)) {
// Set console input codepage to UTF16
#ifdef __MINGW32__ /* UTF16 requires wmain in MinGW */
_setmode(_fileno(stdin), _O_TEXT);
#else
_setmode(_fileno(stdin), _O_WTEXT);
#endif

// Turn off ICANON (ENABLE_LINE_INPUT) and ECHO (ENABLE_ECHO_INPUT)
dwMode &= ~(ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
Expand Down

0 comments on commit 5dc35d3

Please sign in to comment.