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

前端 未结 5 1434
生来不讨喜
生来不讨喜 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条回答
  •  梦毁少年i
    2021-01-05 02:52

    Then you cannot use std::cout anywhere else to print stuff from your program. Change std::cout to a std::ostream and then pass your file or std::cout as required.

提交回复
热议问题