Is there a way to modify the printf in order to output string on a file rather than to the console?
I tried looking up something on the Internet and found calls like dup, dup2 and fflush that might be associated with this.
EDIT:
Maybe I wasn't clear.. the thing is that this was in a C exam question.. the question is as follows:
Explain how a program that normally output strings to screen (using printf()) can be made to output string to a file, without changing any code in the mentioned program.
fprintf? Or using shell redirection (./myprogram > some_file)?