Error checking on stdout: is "relying on ferror" an alternative?

276 Views Asked by At

Does ferror() aggregate all errors of previous fputc(stdout), fputs(stdout), putc(stdout), putchar or puts calls?

At least when not using wide strings?.. (Nor printf().)

If it does then may it be an error checking strategy to check for errors only at the end of a series of putc-like calls? (Otherwise using ferror() and the stream's error indicator flag seem to be redundant...)


(Edit)

Is this question already answered??..

If so, please help: yes or no is the answer?

Do I have to check each and every return value of fputc(stdout) et al or not? (If I do not want to catch errors early, it is enough to detect errors after a couple of output operations.)

I surely know (knew) that some sort of errors cause setting the stream's error flag. The question was that whether all errors (any error that causes fputc etc. return negative) sets the stream's error flag.

0

There are 0 best solutions below