Jump to content
  • Advertisement
Sign in to follow this  
Leigher

[C++] Immediate reaction after receiving input from keyboard.

This topic is 3941 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello again, I've run into this little problem. I need to be able to extract what someone wrote into the console without him pressing ENTER, for example when asked to press y or n, as soon as the user presses the button some action is taken, instead of having to wait for him to press the letter and then press enter. I've tried to look for solutions to this in the iostream library, but none of the methods in the cin object seem to do what I need. How would I go about doing this?

Share this post


Link to post
Share on other sites
Advertisement
The C++ standard library has no support for this. You'll need to look at OS specific functionality (such as kbhit() and getch()) or third party libraries (like ncurses or pdcurses).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!