This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: About fwrite(s, 0, 1, fp)
- To: drepper@cygnus.com
- Subject: Re: About fwrite(s, 0, 1, fp)
- From: tb@MIT.EDU (Thomas Bushnell, BSG)
- Date: Mon, 26 Oct 1998 09:50:03 -0500
- Cc: libc-hacker@cygnus.com
From: Ulrich Drepper <drepper@cygnus.com>
Date: 24 Oct 1998 20:19:58 -0800
ISO C says:
The fwrite function returns the number of elements successfully
written, which will be less then nmemb only if a write error is
encountered.
I.e., returning 1 is correct. There was no write error. Another bug
in the testsuite.
The Irix man page reads:
Both fread and fwrite always return a nonnegative integer indicating the
number of items read or written. This will be equal to nitems unless an
error occurred, the value of size is zero, or fread or fwrite detect that
a request has been made to read (or write) more data than is addressable.