Is there a way to to couple two streams (or file descriptors) together so that writing to one stream will also write to the second one? (C, Linux)
Thanks.
The first thing that came to mind to me was also "tee". So, let's combine C and the shell with popen:
FILE * multi_out;
multi_out = popen( "tee file1.out > file2.out", "w");
/* error checks, actual work here */
pclose( multi_out);
/* error checks here */
As a Unix bigot, I have assumed you are not trying this on Windows.