Replacing system("PAUSE")

This is a discussion on Replacing system("PAUSE") within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by jk1998 I know that using system("PAUSE") to pause a running program is bad. But I need it ...

  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
    20,975
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    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
    20,975
    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.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    Registered User
    Join Date
    Jan 2005
    Posts
    7,317
    >> 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.

Page 2 of 2 FirstFirst 12
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, 06: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21