Re: function



Bill Cunningham wrote:

<snip>

Now here's what I tried in error checking that gave me a warning.
must've messed up.

if((fputc(a,fp))!=NULL)

If you read your system's documentation for fputc you'll find that it
returns either the character passed (as an int) or EOF on error. NULL
is the wrong value to be comparing with. The above is better written
as:

if (fputc(ch, stream) == EOF) {
/* error */
}

if((fclose(fp))!=NULL)

Again, fclose will return EOF on failure.

<snip>

.



Relevant Pages