|
fprintf segmentation fault
I am using this line of code in my program:
fprintf(stderr, "Running interchange total is: %d\n", interchangeCount);
This causes a segmentation fault. However, if I change the line to this:
printf("Running interchange total is: %d\n", interchangeCount);
there is no segmentation error. If I add for instance 'fputc(0, stderr);' before OR after the bad fprintf, there also is no segmentation fault. I can also remove the '%d' and 'interchangeCount' from the bad fprintf and stop the fault. Any help/insight would be appreciated.
|