Is there any way to redirect the output of the system() function? I know there is for redirecting stdout, but I can't make this work with system().
I tried to store the output of a system command in a file, like so:
...but this doesn't help. Is there any way to do this?
Thank you.
I tried to store the output of a system command in a file, like so:
Code:
FILE *File = NULL;
freopen_s(&File, "somefile.txt", "w", stdout);
system ("dir");
fclose(stdout);
Thank you.
Comment