Reading from input stream C++

Started by
3 comments, last by Nervo 20 years, 4 months ago
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.
Well, R2D22U2..
Advertisement
Even though I don't consort with your type anymore, I've found these:

Says you can't...
experts exchange I think this helps

[edited by - kordova on November 28, 2003 12:02:25 AM]
Look up getch() (assuming you''re on Windows)
daerid@gmail.com
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.
Well, R2D22U2..
quote:Original post by Nervo
thanks kordova!

Don''t thank me. Thank ... oh wait I''m not there anymore. What I meant to say is thank Google™©®: "c++" get input char without enter. Cheers!

This topic is closed to new replies.

Advertisement