tags 665780 fixed-upstream thanks Hello Regid,
On Tue, Mar 27, 2012 at 12:31 AM, Regid Ichira <regi...@yahoo.com> wrote: > --- On Mon, 3/26/12, Michael Kerrisk (man-pages) <mtk.manpa...@gmail.com> > wrote: > >> This patch makes no sense to me. > > Why not? Won't > > char c[10]; > fwrite(c, sizeof(char), sizeof(c), stream); > > be writing 10 bytes, and returns 10? I think the intention of the composer > of the page was to emphasize that the number of items returned is not > necessarily the number of bytes. > >> How could this information be useful? > > 1. It is an accurate description. > 2. The current phrasing is more confusing for beginners. > > I also slightly rephrased it: [...] Sorry. I was a hasty reading your patch--I noticed what you added, but not what you removed ("(i.e., not the number of characters)"). I think that your change does improve the page. I've applied a modified version of your patch for upstream 3.39. The patch is shown below. Cheers, Michael --- a/man3/fread.3 +++ b/man3/fread.3 @@ -40,7 +40,7 @@ .\" Modified Thu Apr 20 20:43:53 1995 by Jim Van Zandt <j...@vanzandt.mv.com> .\" Modified Fri May 17 10:21:51 1996 by Martin Schulze <j...@infodrom.north.de> .\" -.TH FREAD 3 1996-05-17 "GNU" "Linux Programmer's Manual" +.TH FREAD 3 2012-03-30 "GNU" "Linux Programmer's Manual" .SH NAME fread, fwrite \- binary stream input/output .SH SYNOPSIS @@ -79,13 +79,18 @@ obtaining them from the location given by For nonlocking counterparts, see .BR unlocked_stdio (3). .SH "RETURN VALUE" +On success, .BR fread () and .BR fwrite () -return the number of items successfully read or written (i.e., not the -number of characters). -If an error occurs, or the end-of-file is -reached, the return value is a short item count (or zero). +return the number of +.I items +read or written. +This number equals the number of bytes transferred only when +.I size +is 1. +If an error occurs, or the end of the file is reached, +the return value is a short item count (or zero). .PP .BR fread () does not distinguish between end-of-file and error, and callers must use -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org