On Tue, Aug 5, 2008 at 3:07 PM, Bill Cunningham <[EMAIL PROTECTED]> wrote:
> 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?
Yep, but you still shouldn't be comparing EOF to the file pointer you
have just closed. You want to capture the output of fclose() into an
int and then see what that value is.
The man page says:
RETURN VALUE
Upon successful completion 0 is returned. Otherwise, EOF is
returned and the global variable errno is set to
indicate the error. In either case any further access
(including another call to fclose()) to the stream
results in undefined behaviour.
-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi