Re: hold program execution, cin not sequential?

Discussion in 'C++' started by Thomas Matthews, Jul 18, 2003.

  1. klaas wrote:

    > problem:
    > My program works like a debugger allowing someone to step through it's
    > execution seeing the result of each computation step. So the program has
    > to halt until the user does something on his keyboard and then resume
    > computation.

    [snip]

    > and also does anybody know a better way to hold the programs execution
    > until a button is pressed, with a console app?
    >
    > regards klaas.
    >


    You need to use an operating specific function. Something that will
    suspend your program until a key is hit. This is often termed as a
    signal, or mutex. This is the best method (or at least the most
    politically correct).

    An alternative is to have your program poll the keyboard, using
    operating system specific function(s), until a key is detected.
    This is unfriendly to other processes that may be running on
    your machine.

    Ask the experts in a newsgroup that discusses your operating
    system or compiler. The _standard_ C++ language, which is
    discussed in this newsgroup, has no facilities or concepts
    of keyboards.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
    Thomas Matthews, Jul 18, 2003
    #1
    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. TaiwanNoWhere

    cin and cin.clear() problem

    TaiwanNoWhere, Oct 13, 2003, in forum: C++
    Replies:
    8
    Views:
    4,085
    P.J. Plauger
    Oct 17, 2003
  2. Chris Mantoulidis

    std::cin.ignore() and std::cin.clear()

    Chris Mantoulidis, Jan 6, 2004, in forum: C++
    Replies:
    5
    Views:
    17,122
    Kevin Saff
    Jan 6, 2004
  3. Kay

    Cin and hold the screen

    Kay, Sep 5, 2004, in forum: C++
    Replies:
    1
    Views:
    355
    Kai-Uwe Bux
    Sep 5, 2004
  4. Aleander

    cin and cin.getline()

    Aleander, Mar 6, 2005, in forum: C++
    Replies:
    5
    Views:
    8,648
    Alex Vinokur
    Mar 6, 2005
  5. Fernando
    Replies:
    4
    Views:
    1,634
    Fernando
    Nov 16, 2011
Loading...

Share This Page