fread [C++ Reference]
Keywords: c,io,fread
Date: 2010-01-07T12:09:28-0800

[[fread]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## fread

Syntax:

        #include <cstdio>
        size_t fread( void *buffer, size_t size, size_t num, FILE *stream );

The function fread() reads num number of objects (where each object is size bytes) and places them into the array pointed to by buffer.

The data comes from the given input stream.

The return value of the function is the number of objects read. If the return value does not equal `num`, either the end of file has been reached or an error occurred.

To figure out whether it has encountered an error or reached the end of file, use either ferror or feof.

Related Topics: fflush, fgetc, fopen, fputc, fscanf, fwrite, getc, feof, ferror

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •