执行输出到文本文件

发布于 2024-08-29 09:07:21 字数 120 浏览 1 评论 0原文

我正在使用 Visual Studio 2008 编写一个 C 程序。我使用 F7 进行编译,使用 F5 执行该程序。当我按 F5 时,执行窗口包含输出。但我希望将输出保存到文本文件中。如何在视觉工作室中执行此操作。请帮助我。

I am writing a C program using Visual Studio 2008. I use F7 to compile and F5 to execute the program.When I press F5 an execution window contains the output. But I want the output to get saved to a text file. How to do this in visual studio. Please help me someone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

狼性发作 2024-09-05 09:07:22

您可以从命令行运行相同的可执行文件并将其输出重定向到文件,如下所示:

C:\dir_of_the_executable> myprogram.exe > output.txt

You can run the same executable from the command line and redirect its output to a file as:

C:\dir_of_the_executable> myprogram.exe > output.txt
ぃ双果 2024-09-05 09:07:21

我认为使用命令行参数>输出路径就可以了。例如:

myapp.exe >D:\result.txt

将应用程序输出定向到 result.txt 文件。如果从 Visual Studio 中运行应用程序,则可以使用“项目属性 > 调试”配置命令行参数。

I think using the command line parameter >output path will do the trick. for example:

myapp.exe >D:\result.txt

will direct the app output to result.txt file. If you running the application from within Visual Studio, you can configure the command line parameters using "project properties > Debug".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文