CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    27

    How to pause a program in the command window?

    I am writing a program without GUI, simple console program.
    How can I pause the program? For example, while the program is running in the command window, press some key, and modify some parameter and let the program continue to run.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: How to pause a program in the command window?

    Quote Originally Posted by isulsz View Post
    I am writing a program without GUI, simple console program.
    How can I pause the program? For example, while the program is running in the command window, press some key, and modify some parameter and let the program continue to run.
    Can you give me an example of a program that does what you're describing? Or at least clarify what you're trying to accomplish?

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Jan 2010
    Posts
    9

    Re: How to pause a program in the command window?

    You may accomplish what you need by running your executable with a debugger -- for instance "gdb" (it comes free from gnu) that runs at the command prompt. It is very simple to use at console:

    example
    >gdb a.out

    You can pause your program within a debugger run, by setting a breakpoints(pause at a certain line number or function call in your source code) or watchpoints(pause when a condition changes). Debugger will let you modify the value of variables and continue execution. You can also backtrace (within the function calls stack) within a debugger.

  4. #4
    Join Date
    Jan 2010
    Location
    Maryland
    Posts
    1

    Re: How to pause a program in the command window?

    system("PAUSE");

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured