Is there a way to catch the stderr and stdout in Visual Studio?(有没有办法在 Visual Studio 中捕获标准错误和标准输出?)
问题描述
有没有办法在 Visual Studio 中捕获标准输出和标准错误?例如,当我使用
Is there a way to catch the stdout and stderr in Visual Studio? For example, when I use
cout <<"Hello world!"<< endl;
一个黑色的窗口出现又消失.它太快了,我看不到它.IDE 中有一个输出部分,但它只允许我从构建和其他内容中选择显示输出,但不能选择标准输出.
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.
推荐答案
不要使用Start Debugging"命令,如果要检查输出,请使用Start without Debugging".我一般都是这样处理的.命令提示符窗口将保持打开状态,直到您将其关闭.如果出现崩溃或其他情况,您始终可以将 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 中捕获标准错误和标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有办法在 Visual Studio 中捕获标准错误和标准


基础教程推荐
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- CString 到 char* 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 初始化列表*参数*评估顺序 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01