These are often ignored for a couple of reasons. First, for most systems, the chances are a problem with them is sufficiently remote that most people just don't care.
Second, because if they do fail, there's often relatively little you can do about it anyway--if the OS has gotten into a state where writing to a file fails, the usual reactions such as displaying a message to the user and/or logging the error may easily fail as well.
Finally, in most cases you can simplify the problem quite a bit: do your I/O, and then only do an error check on whether fclose
succeeded. If the file has gotten into a failed state, you can expect fclose
to fail, so catching the error earlier (when you did the I/O) is typically only an optimization--you can detect the same problem by only checking fclose
, though you might waste some time in futile attempts to write a file after you could have detected a problem.
Even checking the return from fclose
is fairly unusual though. You still have the same problems as mentioned above: if system has failed to the point that it fails, there's a fairly decent chance that most of your attempts at reacting to the failure will also fail.
There are still some cases where it makes sense though. For example, consider moving a file from one place to another (e.g., across a network). You want to check that you wrote the data to the destination successfully before you delete the source file. In this case, checking the return from fclose
is a fairly easy way to reduce the chances of destroying the user's file, in case the attempt at copying failed.