Results 1 to 3 of 3

Thread: getchar with c++

  1. #1
    Join Date
    Jun 2013

    getchar with c++

    Hello. I am trying to set up a pause function in my program. I have tried cin.get() and getchar(), but they only work once in each of my functions.
    The program likes to skip to the very last one and use that one only. It is for a text adventure, and here is the code for it.

    int wait()
        cout<<"Press enter to continue..."<<endl;
    Are there any other pausing commands that I could use? Thanks!
    Last edited by SirGuineaPig; June 27th, 2013 at 06:58 AM.

  2. #2
    Join Date
    Mar 2010
    Lubuntu 14.04 Trusty Tahr

    Re: getchar with c++

    Don't cin and cout use buffered IO? You want to use unbuffered IO, right? What, exactly, is in the wait() function?

    BTW, I find the code hard to read. A little more white space would help.

  3. #3
    Join Date
    Jun 2013

    Re: getchar with c++

    I just wanted to make a pause function to stop the program like system("PAUSE") would, but to where it isn't system-dependent.
    It has skipped over the first time the wait() function appears in the program and gone to the next.
    Also, I am kind of fuzzy on what unbuffered/buffered IO is. What are they?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts