如何查询使用C键盘键? [英] How to poll a keyboard key in C?
问题描述
我要寻找一些替代的kbhit()的Mac,这将让我轮询特定的键盘键的状态。我唯一的要求是,它不会阻塞,或要求我打回车键。我看到这个网站的一些类似的职位,但他们似乎都被阻塞。
I am looking for some sort of alternative to kbhit() for Mac, that will allow me to poll the state of a specific keyboard key. My only requirement is that it not be blocking, or require me to hit the enter key. I saw some similar posts on this site, but they all seemed to be blocking.
我真的只是想能够运行一个循环,并检查特定键是否pressed或每个循环中pssed,而不会减慢或阻断我的循环的其余部分未$ P $。
I really just want to be able to run a loop and check whether a specific key is pressed or unpressed during each loop, without slowing down or blocking the rest of my loop.
推荐答案
从C-FAQ:
中写的kbhit code片段集
"A collection of code fragments for writing kbhit"
http://c-faq.com/osdep/kbhit.txt
这篇关于如何查询使用C键盘键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!