If I make a dup of the stdout stream (in order to use it later) and make freopen of the stdout stream to the file and then printf("data"), the file is not updated immediately with data. It is updated only after I perform fflush(stdout).
Does the fflush(stdout) have some additional side effects?
Is there some more elegant way to do this?