Can I redirect the stdout and stderr to a temporary file by the following code ?
freopen(filename, "w", stderr);
freopen(filename, "w", stdout);
But, how come I cannot print characters to the original stdout and stderr by doing the following code ?
Anyway, how can I achieve it ?