开发者

Capturing the input stream as a user types

I am working on a C++ based command line tool and I want to capture the user's keystrokes in real-time without requiring them to hit Return to commit the input. I can't seem to find an iostream call to support this kind of behavior but I recall from my college years th开发者_运维百科at it can be done. Can anyone point me in the right direction?


That is outside of the C++ spec and requires OS specific calls. On Posix, you do this by enabling raw or cbreak mode instead of cooked mode.

The easiest way to enable this is via curses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜