Press any key to...

J

JKop

How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?


-JKop
 
W

William Payne

JKop said:
How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?


-JKop

You can't do this in standard c++, because C++ only has buffered input.
However, using a library local to your platform to accomplish this should be
easy. For example, you might have the ncurses-library available on your
platform.

/ WP
 
O

osmium

JKop said:
How in the name of Christ can I do this with Standard C++!

Obviously:

std::cout << "Press any key to exit...";

char k;
std::cin >> k;

doesn't work.

All I want is one miserable keystroke.

Does anyone else think that Google is crap for searching
for programming related info?

I can see why you say that. But it is easy to forget that there are main
branches to google and this question is more likely to get results in google
groups (the old Deja) than the main group. I went to google groups and
typed "press any key" and got lots of promising looking hits on the first
page. I must admit I didn't look at them but the combination of skimming
and trying to guess what the newsgroup title means they are posted to are a
help. Sometimes looking at the number of messages is useful too. You can
also go to advanced search to limit the number of non-germane hits.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top