myprog.exe
This displays on the screen
myprog.exe > file.txt
This stores the output in a file.
If you want to see both at the same time, write your code better or get Unix/Linux
myprog.exe | tee file.txt
This stores output in file.txt AND also displays on the screen.
>but i think its a very long procedure to build in the fputs line after each printf line
Well it's not to hard to do this
Code:
int myprintf ( const char *format, ... ) {
// some magic using vsprintf
if ( outputfile ) {
fputs( buff, outputfile );
}
fputs( buff, stdout );
}