redirect stdout/stderr to file under unix c++ - again

前端 未结 6 986
说谎
说谎 2021-02-15 15:51

What I want to do

redirect stdout and stderr to one or more files from inside c++

Why I need it

I am using an external, pr

6条回答
  •  余生分开走
    2021-02-15 16:07

    well i u'd better use freopen()

    Usage Syntax:

    freopen("RedToFile","r",stdout);
    or
    freopen("/dev/null","a",stdout);
    

    the same goes for "stderr"

提交回复
热议问题