Thread: Replacing system("PAUSE")

  1. #16
    Registered User
    Join Date
    May 2007
    Posts
    10
    Quote Originally Posted by jk1998 View Post
    I know that using system("PAUSE") to pause a running program is bad. But I need it so that user can read the output. Is there any way to achieve the same effect of system("PAUSE") without using it? Thanks in advance
    Is this the sames as using
    Code:
    void mypause()
    
         mypause();
         cin.get();
    Or is system("pause"), something else, entirely?

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What is mypause()? It looks like you have an infinite recursive function. "pause" is used at the Windows command line to wait for a key press to continue execution of the program.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Registered User
    Join Date
    May 2007
    Posts
    10
    To tell the truth I am not really sure what 'mypause()' is, however, I got it from the FAQ's, to stop my command line from closing. It took me about 3 hours to find something that would work.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Oh, so mypause() refers to the example in the FAQ... it looked like you were trying to define your own function due to inconsistent indenting. As such, refer to the FAQ.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    >> Or is system("pause"), something else, entirely?
    It is something else entirely that attempts to do basically the same thing. It is another option for what to put inside the mypause function provided in the FAQ.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-14-2008, 05:56 PM
  2. Replacing a notebook drive
    By RoD in forum Tech Board
    Replies: 2
    Last Post: 03-29-2005, 07:07 AM
  3. Trouble replacing line of file
    By Rpog in forum C Programming
    Replies: 4
    Last Post: 04-19-2004, 10:22 AM
  4. Replacing string in file
    By Spedge in forum C Programming
    Replies: 1
    Last Post: 08-19-2003, 02:53 AM
  5. replacing a part of a string
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 05-20-2002, 03:32 AM