Suspend after debugging command line application in Visual Studio
Is there a way to write a separate batch file or add a system call to pause or getch or a breakpoint before the end of the main function to keep the command window open after the command line application has finished running?
Differently, is there a way in the project properties to run another command after the target path has started? If my program is "foo.exe" then it is equivalent to a batch file containing
@foo @pause
Edit: added "or getch or breakpoint"
+1
source to share
4 answers
In C ++
#include <conio.h>
// .. Your code
int main()
{
// More of your code
// Tell the user to press a key
getch(); // Get one character from the user (i.e a keypress)
return 0;
}
If you are in a batch file, the "pause" command displays "Press any key to continue" and waits for a key press.
0
source to share