Reads data from a stream.
#include <stdio.h> size_t fread ( void *buf, size_t elsize, size_t nelem, FILE *fp);
(OUT) Points to the location of the array to receive data.
(IN) Specifies the size (in bytes) of each element.
(IN) Specifies the number of elements.
(IN) Points to the file to be read.
If successful, returns the number of complete elements successfully read. This value can be less than the requested number of elements if a read error or end-of-file is encountered.
If an error occurs, fread sets the error indicator for the stream and sets errno to one of the following:
The fread function reads nelem elements of elsize bytes each from the file specified by fp and places them in the array pointed to by buf. The file position indicator for the file is advanced by the number of bytes successfully read.