Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Press any key to...

Reply
Thread Tools

Press any key to...

 
 
JKop
Guest
Posts: n/a
 
      09-16-2004
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
 
Reply With Quote
 
 
 
 
William Payne
Guest
Posts: n/a
 
      09-16-2004

"JKop" <(E-Mail Removed)> wrote in message
news:tAe2d.28109$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      09-16-2004
JKop writes:

> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Canon XT - doing full press without wating at half-press Wolfgang Weisselberg Digital Photography 0 10-25-2010 01:37 AM
Re: Canon XT - doing full press without wating at half-press Ray Fischer Digital Photography 0 10-24-2010 06:06 AM
simulated cursor-key-up/down key-press changed ? polen.t2006@freenet.de ASP .Net 0 10-11-2007 11:23 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
disk i/o error replace the disk and press any key Bryan Henderson Computer Support 5 05-04-2004 07:05 PM



Advertisments