I\'m looking for a way in C to programmatically (ie, not using redirection from the command line) implement \'tee\' functionality such that my stdout goes to both stdout and
There's no trivial way of doing this in C. I suspect the easiest would be to call popen(3), with tee as the command and the desired log file as an arument, then dup2(2) the file descriptor of the newly-opened FILE* onto fd 1.
But that looks kinda ugly and I must say that I have NOT tried this.