size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);

Reads data from the given stream into the array pointed to by ptr. It reads nmemb number of elements of size size. The total number of bytes read is (size*nmemb).

On success the number of elements read is returned. On error or end-of-file the total number of elements successfully read (which may be zero) is returned.