----- Original Message -----
From: "Brett McCoy" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, August 05, 2008 2:40 PM
Subject: Re: [c-prog] error checking
> Yes, you are comparing EOF (which is NOT a pointer, it's usually -1)
> to fp (which is a pointer). Not sure why you are doing that
> comparison, since it would not indicate any kind of error anyway. It
> would be more correct to check what is returned from fclose to see if
> EBADF is returned (bad file descriptor). flclose() also will set the
> global variable errno if necessary.
I have this reference book that says fclose returns EOF on error. If I
am reading that right that is why I compared to EOF. So use -1 from now on
then?
Bill