Execution output to text file

﹥>﹥吖頭↗ 提交于 2020-01-05 09:34:20

问题


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.


回答1:


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".




回答2:


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


来源:https://stackoverflow.com/questions/2656951/execution-output-to-text-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!