有没有办法在Visual Studio中捕获stderr和stdout? [英] Is there a way to catch the stderr and stdout in Visual Studio?
问题描述
有没有办法在Visual Studio中捕获stdout和stderr?例如,当我使用
Is there a way to catch the stdout and stderr in Visual Studio? For example, when I use
cout <<"Hello world!"<< endl;
黑色窗口出现并消失。它是这么快,我看不到它。在IDE中有一个输出部分,但它只允许我选择显示输出从build和别的,但没有选择stdout。
A black window appears and disappears. It's so fast that I can't see it. There is a output section in the IDE but it only allow me to choose display output from build and something else but without the choice of stdout.
一个欺骗的解决方案可能调用
A cheating solution maybe calling
system("pause");
但它听起来不正确。我在选项中搜索,但我找不到一个项目。
but it doesn't sound right. I searched in the option but I can't find an item.
任何人都有什么想法?谢谢。我刚开始使用VS,我在Linux之前。
Anyone has any idea? Thanks. I just start to use VS and I'm on Linux before.
推荐答案
而不是使用开始调试你想检查输出,使用开始不调试。这是我一般如何处理它。命令提示符窗口将保持不变,直到您关闭它。如果出现崩溃或其他原因,您可以随时将Visual Studio重新连接到该进程,或者使用开始调试运行它。
Rather than using the "Start Debugging" command, if you want to check the output, use "Start Without Debugging". That's generally how I handle it. The command prompt window will remain up until you close it. If there's a crash or something, you can always reattach Visual Studio to the process, or just run it with "Start Debugging".
这篇关于有没有办法在Visual Studio中捕获stderr和stdout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!