Writing to both stdout & a file

前端 未结 7 567
耶瑟儿~
耶瑟儿~ 2020-12-07 03:17

I have a parent process which forks out a child to perform execv().

I need the output given by execv() to stdout to be displayed onscreen as also copied to a log fil

7条回答
  •  遥遥无期
    2020-12-07 03:58

    If you don't want to use a tee, before you write the data, write it to a file, then send it to stdout.

    You should write a logging function that does this for you to make it cleaner.

提交回复
热议问题