开发者

Execution output to text file

开发者 https://www.devze.com 2022-12-26 23:52 出处:网络
I am writing a C program using Visual S开发者_运维问答tudio 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 ge

I am writing a C program using Visual S开发者_运维问答tudio 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.


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


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号