From what I've read, the only indication fprintf gives of an error is a
negative return value. I have a series of writes to a file using
fprintf, and, while I need to know if a failure has occurred, I don't
particularly care which call failed - just that one of them did. I was
thinking I might simply check the return value of the last call to
fprintf. Is it reasonable to assume that if one call to fprintf fails,
then all subsequent calls will fail? Or should I check (shudder) after
every call?
Secondly, what's the best way to portably determine whether a file
exists? The only way I can see to do it is to attempt to open it for
reading, and see if that fails, but then you still aren't guaranteed
that the file doesn't exist.
Thanks in advance.
Jim