On Thu, 20 Feb 2003, Jay Levitt wrote: > Thanks.. for my education, are there cases (legitimate or just bugs) where > FILE could be null but errno == 0? I haven't done a whole lot of UNIX > programming yet.
No, but I have seen cases where errno won't be reset on success (errno != 0 and file != NULL). I'd just rather test for the real error, then check errno. Basically, fopen()'s return values are defined as follows: Upon successful completion fopen, fdopen and freopen return a FILE pointer. Otherwise, NULL is returned and the global variable errno is set to indicate the error. So, errno isn't defined if fopen() returns a good pointer. -Rob -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Rob Siemborski * Andrew Systems Group * Cyert Hall 207 * 412-268-7456 Research Systems Programmer * /usr/contributed Gatekeeper