View Bug Activity | Format For Printing
C standard states that all opened FILEs are closed (hence output streams flushed) when the programs calls exit() or returns from main. So, one would expect that the close function of a FILE created by fopencookie should also be called at program exit, which is not the case.
This wasn't in the design. The system doesn't know anything about the actual implementation. Perhaps some of the resources needed for the cookie functions is already gone. It's not safe to try to close the FILE. Aside, there might be code out there which depends on the current behavior. It'd different if from day one this requirement would have existed. And whatever ISO C says doesn't apply here because cookie streams are not in ISO C.