by Daniel Shawul » 09 Nov 2004, 06:33
i didn't explain the problem well. The BiosKey function uses
PeakNamedPipe for pipes (Winboard GUI) and GetNoofConsoleEvents
for conosol.
int Bioskey(void) {
static int init = 0, pipe;
static HANDLE inh;
DWORD dw;
if (XBoard) {
if (!init) {
init = 1;
inh = GetStdHandle(STD_INPUT_HANDLE);
pipe = !GetConsoleMode(inh, &dw);
if (!pipe) {
SetConsoleMode(inh, dw & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
FlushConsoleInputBuffer(inh);
}
}
if (pipe) {
if (!PeekNamedPipe(inh, NULL, 0, NULL, &dw, NULL)) return 1;
return dw;
}
else {
GetNumberOfConsoleInputEvents(inh, &dw);
return dw <= 1 ? 0 : dw;
}
}
else return _kbhit();
}
int ReadInput (char * s, size_t sz)
{
if (fgets (s, sz, stdin))
return 1;
return 0;
}
the ReadInput funcion doesn't work for console mode.
daniel