调试时保持控制台窗口打开 [英] Keeping console window open when debugging
问题描述
当我开始一个没有调试的程序(Ctrl + F5)时,我必须按一个键才能在程序完成时关闭控制台窗口。当我使用调试(F5)启动程序时,控制台窗口立即关闭。在Visual Studio中有一个选项,在调试时会保持窗口打开?
(我知道有一千种方法在代码中手动不想触摸代码。)
添加一个断点到 main()
方法。这样如果程序完成(除非它崩溃在进程中 - 这将触发一个中断无论如何),无论使用 main
中的哪个返回语句,它都会中断。 p>
When I start a program without debugging (Ctrl+F5), I have to press a key to close the console window when the program is finished. When I start the program with debugging (F5), the console window closes immediately. Is there an option in Visual Studio that will keep the window open when debugging?
(I know of a thousand ways to do it "manually" in code, but I don't want to touch the code.)
Add a break point to the ending bracket of the main()
method. That way if the program finishes (unless it crashes in the process - which will trigger a break anyway) it will break no matter which return statement in the main
was used.
这篇关于调试时保持控制台窗口打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!