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: hjl@lucon.org (H.J. Lu)
- Date: Sun, 25 Oct 1998 08:22:39 -0800 (PST)
- Cc: libc-hacker@cygnus.com
>
> hjl@lucon.org (H.J. Lu) writes:
>
> > What should fwrite(s, 0, 1, fp) return? VSX-PCT expects 0. What
> > does ANSI C say on it? Solaris 2.5.1/2.6 and HP-UX 10.20 return
> > 0. Should we change it to 0?
>
> 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.
>
I am not sure about it. If everyone else returns 0, it doesn't make
glibc look good. Can someone check VC++?
Thanks.
--
H.J. Lu (hjl@gnu.org)