C语言 curses.h 中空格键的关键代码是什么
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13434254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
what is the key code for space bar in curses.h
提问by wenincode
I just have a simple question, I cannot find what the key code is for space bar in curses.h. ex. I know the code for down is KEY_DOWN. can anyone help?
我只是有一个简单的问题,我在curses.h 中找不到空格键的关键代码是什么。前任。我知道 down 的代码是 KEY_DOWN。有人可以帮忙吗?
回答by John Vulconshinz
回答by arve
A couple of years late, but since this was the top hit when I was confused, I want to contribute! :-)
晚了几年,但由于这是我困惑时的热门话题,我想做出贡献!:-)
What you need to do is to use ord(c). For example:
您需要做的是使用 ord( c)。例如:
c = getch()
if c == ord(' '):
do_something()

