Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Reading from input stream C++

This topic is 5463 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

Suppose I had a user that for whatever arbitrary reason should input n characters in a program, but I don''t want the user to have to hit enter in order for the program to begin processing what is read from the first two characters, then how is it done? It should be like as soon as the user hits the nth character the program starts working with it. I tried getchar() and cin.get() in a loop to read a character at a time up to a set limit and then go from there, but it obviously will not work without having to hit enter at the console each time. It seems so easy, but I can''t seem to find info anywhere on doing it.

Share this post

Link to post
Share on other sites
thanks kordova!

I solved my problem.

getch is ok, but getche is even better, because it echos back to the screen..

good thing vs.net include conio.h then.

Share this post

Link to post
Share on other sites

  • 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!