--- 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: --- a/fread.3 2012-03-26 13:03:11.542825729 +0200 +++ b/fread.3 2012-03-26 12:58:04.000000000 +0200 @@ -47,8 +47,8 @@ fread, fwrite \- binary stream input/out .nf .B #include <stdio.h> .sp -.BI "size_t fread(void *" ptr ", size_t " size ", size_t " nmemb \ -", FILE *" stream ); +.BI "size_t fread(void *" ptr ", size_t " size ", size_t " nmemb ", +.BI " FILE *" stream ); .sp .BI "size_t fwrite(const void *" ptr ", size_t " size ", size_t " nmem b , .BI " FILE *" stream ); @@ -82,10 +82,12 @@ For nonlocking counterparts, see .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 items successfully read or written. This number +equal the number of 8 bit characters only when +.I size +is 1. It can be less then +.I nmemb +(or zero) if an error occurs, or the end-of-file is reached. .PP .BR fread () does not distinguish between end-of-file and error, and callers must u se -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org