fread(3) man page EXAMPLES section is misleading

Bug #345062 reported by Jared D. McNeill on 2009-03-18
Affects Status Importance Assigned to Milestone
manpages-posix (Ubuntu)

Bug Description

Binary package hint: manpages-posix-dev

Description: Ubuntu 8.10
Release: 8.10
  Installed: 2.16-1
  Candidate: 2.16-1
  Version table:
 *** 2.16-1 0
        500 intrepid/multiverse Packages
        100 /var/lib/dpkg/status

The EXAMPLES section of the fread(3) man page uses the following snippet:

              #include <stdio.h>
              size_t bytes_read;
              char buf[100];
              FILE *fp;
              bytes_read = fread(buf, sizeof(buf), 1, fp);

However, fread returns the number of elements read, not the number of bytes read.

Michael Kerrisk (mtk-manpages) wrote :

The example is okay. The text preceding that example says:

The following example reads multiple **single-byte** elements from the fp stream into the array pointed to by buf.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers