且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将 Visual C++ 控制台输出写入或复制到文本文件

更新时间:2023-12-05 13:16:40

您可以使用 > 重定向 Visual Studio 运行的命令的输出.通过在解决方案资源管理器中选择您的项目并单击 PROJECT->Properties->Configuration Properties->Debugging,将其添加到命令参数中.然后输入>output.txt 到命令参数中.运行应用程序后,该文件将出现在工作目录中 - 默认情况下,该目录与您的 .sln 文件位于同一目录.

You can use > to redirect the output of the command run by Visual Studio. Add it to the command arguments by selecting your project in the solution explorer and clicking PROJECT->Properties->Configuration Properties->Debugging. Then enter > output.txt into the Command Arguments. After you run your application, the file will appear in the Working Directory - which by default is the same directory as your .sln files.