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.
Printable View
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.
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.
system("PAUSE");