我想用“按任意键继续”功能使用kbhit()。 但是,在循环中使用了kbhit()之后,按下的键存储在标准输入中。 因此在下一个scanf()中,从前面按下的按键出现在输入中。 int x,b=0;
printf("Press any key to continue...")
while (b==0) {
b=kbhit();
}
system("cls");
你好,我正在用C创建一个游戏。我想在那里每隔0.1秒打印一帧图片。在此期间,用户可能会或可能不会使用getch()输入。 我该如何编写这样的程序?下面我可以提供给你们一起工作。 do{
usleep(100000); // simple 100 mili second delay
if (getch()==32) (ASCII for a space) // may or may not be