This is probably an easy Visual Studio question, but I couldn't find it on the site.
When I "Start Debugging" a console program, it immediately exits when its finished. Is there any way to have it pause when it ends without putting an explicit pause command at the end of your program?
Start the project with Ctrl + F5 instead of just F5 . The console window will now stay open with the Press any key to continue . . . message after the program exits.
Before the end of your code, insert this line: system("pause"); This will keep the console until you hit a key.
The simplest method to avoid this is to start the application from Visual Studio without using debugging. You do so by selecting "Start Without Debugging" from the Debug menu or by pressing Ctrl-F5. When the program stops executing, you must press a key before the console window closes.
Add a breakpoint just before the application finishes.
You can place Console.ReadLine at the end of the program. That will force program to wait for a newline character input. Or you can place breakpoint at the end of the probram.
"Run without Debugging" does that, but I guess you want to debug still :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With