equivalent of getch() with <iostream>

A

aurgathor

Howdy,

What would be the equivalent of getch() using iostream?

My current code is:

cout << "\nPress <Enter> to continue...";
getch();

but <conio.h> is not kosher for the C++ class.

TIA
 
?

=?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=

aurgathor said:
What would be the equivalent of getch() using iostream?

My current code is:

cout << "\nPress <Enter> to continue...";
getch();

I guess istream::get might be eligible.

char c;
cin.get(c);

Hope that helps,
 
E

evaned

cin.ignore is as close as you're gonna get for that purpose with
standard, portable C++.

There's a getchar() function that will do what you want if you're
actually using the value for something though.
 
K

Karl Heinz Buchegger

aurgathor said:
Howdy,

What would be the equivalent of getch() using iostream?

My current code is:

cout << "\nPress <Enter> to continue...";
getch();

but <conio.h> is not kosher for the C++ class.

Assuming with getch() you mean the function that
* waits for a single keystroke
* returns as soon as a single keystroke is entered

There is no such thing in Standard C++
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top