reassigning FILE pointers & fprintf
I want a way to selectively turn on & off file inputs at compile time without commenting out large portions of code. I thought I could do this:
but I get access violations, presumably because you can't pass fprintf a NULL pointer. So what else can I do to disable opening & printing of the output file? The program I'm writing needs to operate off a CD without writing any outputs.
if(NoWrite) //NoWrite = 1 means no output
fileout = NULL;
printf("Could not open output file!\n");
fprintf(fileout,"writing to output file\n");
//many more of these, and in other places