here is a relevent snippets
the problem is that the first time while executes everything is ok:
fdwMode = ENABLE_LINE_INPUT | //ReadConsole() should wait and read
// characters until ENTER is pressed
ENABLE_ECHO_INPUT | // show characters as you type
ENABLE_PROCESSED_INPUT; // let system process all
// control keystrikes
SetConsoleMode(hStdin, fdwMode) ;
fdwMode = ENABLE_PROCESSED_OUTPUT;
WriteConsole(hStdout, "\npress  for codepage: ", 25, &ch, NULL);
WriteConsole(hStdout, buf, 3, &ch, NULL);
i get on screen:
i enter 1 and press enter then it prints the character.
from this point something strange happens...
while loop continue to execute two more times despite the fact that ReadConsole() should wait for input...
anyone understand where is the problem?