I am a student taking an introductory C course and have our first C midterm coming up. Our test environment would store our actions and printf output to a text file. However, our TA suggested we write to a file ourselves using fprintf just in-case.
Is there a very simple way I can copy my terminal/console output and input (what I enter in after scanf) to a text file like output.txt?
I tried
freopen("output.txt","w",stdout);
but that won't write my scanf input to the text file.
Can anyone help?
pFile = fopen ("output.txt","w");
, and then do your fprintf? – bruceg