有没有办法在 Visual Studio 中捕获标准错误和标准输出?

Is there a way to catch the stderr and stdout in Visual Studio?(有没有办法在 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 中捕获标准错误和标准输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Rising edge interrupt triggering multiple times on STM32 Nucleo(在STM32 Nucleo上多次触发上升沿中断)
How to use va_list correctly in a sequence of wrapper functions calls?(如何在一系列包装函数调用中正确使用 va_list?)
OpenGL Perspective Projection Clipping Polygon with Vertex Outside Frustum = Wrong texture mapping?(OpenGL透视投影裁剪多边形,顶点在视锥外=错误的纹理映射?)
How does one properly deserialize a byte array back into an object in C++?(如何正确地将字节数组反序列化回 C++ 中的对象?)
What free tiniest flash file system could you advice for embedded system?(您可以为嵌入式系统推荐什么免费的最小闪存文件系统?)
Volatile member variables vs. volatile object?(易失性成员变量与易失性对象?)