I wouldn't recommend changing the source just for that. In Linux (or Cygwin) environment just pipe your output to tee
. If you don't have tee
to your disposal, it takes about 20 minutes to write.
Edit:
The core of tee
is
FILE * file = fopen("outfilename", "wb");
char buffer[BUFFER_SIZE];
while(fgets(buffer, BUFFER_SIZE, stdin)) {
fputs(buffer, stdout);
fputs(buffer, file);
}