In trying to get input from the arrow keys via curses (ncurses) it won't catch as KEY_UP etc. I used the keypad function with a true argument but getch still returns an escaped sequence. How do I sift through the values returned by getch() and grab the arrow keys specifically?
相关问题
- Multiple sockets for clients to connect to
- What is the best way to do a search in a large fil
- glDrawElements only draws half a quad
- Index of single bit in long integer (in C) [duplic
- Equivalent of std::pair in C
Standard (VT100-like) terminals send a sequence of characters when the arrow keys are pressed. You just have to keep track of whether or not these are pressed in sequence. Here are the char's to watch for:
I was storing
getch()
calls as char's when they were supposed to be int's. Works perfectly after the switch.I found the same problem on Mac OS X. But it was resolved by adding the following: