You are here:

C++/Reading from Standard Input



I am trying to read from the standard input.
Right now the user should enter a character and
then press Enter.

I was wondering if it's possible to read from
terminal without requiring the user to press
Enter. For example, I'm asking the user a yes/no
question. I want the user to be able to only
press y or n and not have to press Enter

Thanks for your help,

Hello Adrien, thank you for the question.

I believe that you should take a look at the function getch(), which simply waits for a key to be pressed to exit. This would give you the functionality that you describe. A lot of people typically use this function for a press any key... type of deal, where you simply want to pause at the end of an application until the user hits a key. You can find excellent documentation on this function in the MSDN library, which you can use for free at

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 All rights reserved.