Re: function
- From: santosh <santosh.k83@xxxxxxxxx>
- Date: Sat, 31 May 2008 23:42:24 +0530
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>
.
- Follow-Ups:
- Re: function
- From: Bill Cunningham
- Re: function
- References:
- function
- From: Bill Cunningham
- Re: function
- From: Joachim Schmitz
- Re: function
- From: Bill Cunningham
- Re: function
- From: Joachim Schmitz
- Re: function
- From: Bill Cunningham
- function
- Prev by Date: Re: How to print an array of char backward.
- Next by Date: Re: printing error messages
- Previous by thread: Re: function
- Next by thread: Re: function
- Index(es):
Relevant Pages
|