bool kbhit(void)
{
// function without the 4 lines of code below will not work
// but they also screw up the console
initscr();
cbreak();
noecho();
nodelay(stdscr, TRUE);
scrollok(stdscr, TRUE);
int ch = getch();
if (ch != ERR) {
ungetch(ch);
refresh();
return true;
} else {
refresh();
return false;
}
}
Так как у ncurses нет kbhit, я нашел функцию выше. Но они испортили консоль. Вот что происходит, когда я пытаюсь напечатать следующее:
Смотри картинку ![enter image description here](https://i.stack.imgur.com/HDtGo.png)