c - 如何检测使用C中的curses按下的箭头键? [英] How do I detect arrow keys pressed using curses in C?
本文介绍了c - 如何检测使用C中的curses按下的箭头键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在尝试通过curses (ncurses) 从箭头键获取输入时,它不会被捕获为KEY_UP 等.我使用带真参数的键盘函数但getch 仍然返回一个转义序列.如何切换 getch() 返回的值并专门抓住箭头键?
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 returned an escaped sequence. How do I shift through the values returned by getch() and grab the arrow keys specifically?
推荐答案
我将 getch()
调用存储为 char 的,而它们应该是 int 的.切换后完美运行.
I was storing getch()
calls as char's when they were supposed to be int's. Works perfectly after the switch.
这篇关于c - 如何检测使用C中的curses按下的箭头键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文