console input

J

Jim Westwood

Is there a way to get input from the keyboard without
echoing what was typed in standard c++. like
for a password field.
Thanks
 
T

Thom

I know I'm new at this so maybe I missed the bigger question.....but I use
getche() and getch() fairly frequently.
getch() does not echo characters to the screen while getche() does.
Maybe I'm seeing something that is OS or compiler specific? Interesting.

Thom
 
M

Mike Wahler

Thom said:
I know I'm new at this so maybe I missed the bigger question.....but I use
getche() and getch() fairly frequently.

Neither of those functions is part of standard C++.
getch() does not echo characters to the screen while getche() does.
Maybe I'm seeing something that is OS or compiler specific?

Completely implementation-specific.
Interesting.

Not here. :)

BTW please don't top-post.

-Mike
 
D

Dave O'Hearn

Thom said:
I know I'm new at this so maybe I missed the bigger question.....but I use
getche() and getch() fairly frequently.
getch() does not echo characters to the screen while getche() does.
Maybe I'm seeing something that is OS or compiler specific? Interesting.

Yes, those are platform specific, and mixing in calls like that with
stdio or iostreams creates problems of its own. Platform specific
"console" operations usually have their own internal buffers, or no
buffers, and have no access to stdio or iostreams. Sometimes the
behavior is different in annoying ways. At least one favorite console
application I use has something like 'getch' in a loop, and ends up
consuming 100% CPU for I/O polling.

Just be prepared for surprises if you start using a platform's console
operations, especially mixing them with iostreams.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top