有没有办法在Visual Studio中捕获stderr和stdout?

编程入门 行业动态 更新时间:2024-10-28 17:15:26
本文介绍了有没有办法在Visual Studio中捕获stderr和stdout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法在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?

本文发布于:2023-10-06 17:42:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467608.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有办法   Visual   Studio   stderr   stdout

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!