Press any key to...

Discussion in 'C++' started by JKop, Sep 16, 2004.

  1. JKop

    JKop Guest

    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
    JKop, Sep 16, 2004
    #1
    1. Advertising

  2. "JKop" <> wrote in message
    news:tAe2d.28109$...
    > 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
    William Payne, Sep 16, 2004
    #2
    1. Advertising

  3. JKop

    osmium Guest

    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.
    osmium, Sep 16, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Howard

    Press any key

    John Howard, Jul 12, 2003, in forum: C++
    Replies:
    3
    Views:
    535
  2. Andrew Robert
    Replies:
    51
    Views:
    22,588
    Mark McIntyre
    Nov 13, 2003
  3. Timur Ametov

    Message "Press any key to continue"

    Timur Ametov, Apr 26, 2006, in forum: C++
    Replies:
    8
    Views:
    461
    Default User
    Apr 27, 2006
  4. Susan Rice
    Replies:
    9
    Views:
    981
    Marcus Kwok
    Jul 11, 2006
  5. Replies:
    0
    Views:
    460
Loading...

Share This Page