Thread: "Press any key to continue"

  1. #1
    Registered User
    Join Date
    Aug 2003

    "Press any key to continue"


    You know when you compile and run a program, it says "Press any key to continue" when it's finished running? Or back in DOS, when you list contents of a directory with the command dir /p?

    Could you tell me how to simulate this in my program? I'm have this long list that I want to print out, but I'd like it to be listed part by part.

    Is there a function of some sort to accomplish this? I've been using getche(), but that's probably not the proper way.

    Thanks in advance!

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    That works if you don't want it to be portable. If you do want it to, then try doing a "Press enter to continue" and use getchar. You may want to follow that with correct flushing of the input stream, as in this FAQ entry. So that, if they type other keys before enter first, it still works correctly.

    Hope is the first step on the road to disappointment.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    ... and whilst you're in the FAQ:
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM