How to detect when the delete key is pressed on the keyboard?
问题 I want that when the Del key is pressed a certain function is called. How can I achieve that using getch() if possible or otherwise some nested getch() calls? 回答1: The function _getch() returns an "escaped" value for cursor and page control keys. For the keypad and the function keys, that is 0 followed by the key code, for other keys it is 224 followed by the key code. #include <stdio.h> #include <conio.h> #define ESC 27 #define ESC1 0 #define ESC2 224 int main() { int d=-1, e=-1; printf(