Archived

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

Reading from input stream C++

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