How can I know that the user hit the ESC key in a console with ncurses (Linux)?
问题 I have a problem in detecting whether I just got a plain ESC key (just code 27) or whether it was another special key such as an Arrow Up which sends me three bytes: ESC [ A (27 91 65). Now, I understand escape sequences, what I don't understand is how can I possibly know that the user actually typed ESC instead of a special key since both start with 27 and ESC is only 27? Note that I use the wgetch() function from ncurses as in: // initialization not shown initscr() should be enough for this