如何检测使用C中的curses按下的箭头键? [英] How do I detect arrow keys pressed using curses in C?

查看:90
本文介绍了如何检测使用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时,我将它们存储为char.切换后可完美工作.

I was storing getch() calls as char's when they were supposed to be int's. Works perfectly after the switch.

这篇关于如何检测使用C中的curses按下的箭头键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆