#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