Writing ALL program output to a txt file in C++

前端 未结 5 1404
生来不讨喜
生来不讨喜 2021-01-05 02:45

I need to write all my program output to a text file. I believe it\'s done this way,

sOutFile << stdout;

where sOutFile is the ofstr

5条回答
  •  离开以前
    2021-01-05 03:12

    If you want all output in a text file you don't need to code anything extra.

    from the command line:

    program > output.txt
    

    If you only wish to redirect certain output you can use ostream as dirkgently suggested.

提交回复
热议问题