g_input_handle = GetStdHandle(STD_INPUT_HANDLE);
if(g_input_handle == INVALID_HANDLE_VALUE) {
- fprintf(stdout, "error: fail to get the stdin handle\n");
+ D("error: fail to get the stdin handle\n");
g_input_handle = NULL;
return;
}
if(!GetConsoleMode(g_input_handle, &g_console_mode_save)) {
- fprintf(stdout, "error: fail to get the stdin console mode\n");
+ D("error: fail to get the stdin console mode\n");
g_input_handle = NULL;
return;
}
if(!SetConsoleMode(g_input_handle, ENABLE_MOUSE_INPUT)) {
- fprintf(stdout, "error: fail to set console mode\n");
+ D("error: fail to set console mode\n");
return;
}
}
if (g_input_handle != NULL) {
if(!SetConsoleMode(g_input_handle, g_console_mode_save)) {
- fprintf(stdout, "error: fail to restore console mode\n");
+ D("error: fail to restore console mode\n");
}
g_input_handle = NULL;
}
if(g_console_mode_save != NULL) {
while(1) {
if(!ReadConsoleInput(g_input_handle, &i_record, 1, &cNumRead)) {
- fprintf(stdout, "error: fail to read console standard input\n");
+ D("error: fail to read console standard input\n");
break;
}