Console Keyboard hit detection and interpretting

后端 未结 3 1805
天涯浪人
天涯浪人 2021-01-25 14:22

Hey so it\'s been reccomended to me that i should use the kdhit() function to detect a keypress in a console window:

\"If it\'s Windows, the kbhit( ) function is the guy

3条回答
  •  Happy的楠姐
    2021-01-25 14:33

    Use _kbhit() to test if a key is pressed. and when it is use _getch() to get the value. (note _getch() can return 0 or 0xE0 for special keys and call _getch() again for that value) for displaying the characters while reading use _getche().

提交回复
热议问题