fread

Full prototype:

size_t fread(void* restrict, size_t, size_t, FILE* restrict);  

Purpose and Notes:

Reads the amount of bytes determined by the second argument multiplied by the third argument. Reads from the stream associated from the fourth arguments FILE* into the buffer passed in as the first argument.

REWORDED:
Reads the number of (objects) passed in as the third argument of the size passed in as the second argument from the stream associated with the FILE* passed in as the fourth argument into the buffer passed in as the first argument.

If any errors occur or the EOF for the stream was previously set or is reached while reading, then the number returned will be less than that of the third argument. Also errors and EOF will be set for the file stream if they occur.

On success the number returned will be equal to that passed in as the third argument.

Works at the byte level. The function is oblivious to the data type you are trying to read and will just read the number of bytes passed in as the second argument the number of times as the third argument without understanding what the values mean.

Returns:

size_t-Returns the same value passed in as the third argument on success and will return a value less than that as well as set EOF and/or and ERROR indicators for the stream otherwise. The number indicates how many successful objects (a.k.a. groups of the size indicated by the second argument) were read.

Argument 1:

void* restrict-A buffer to store the data read in from the stream passed in as the fourth argument.

Argument 2:

size_t-The size of the objects to be read in.

Argument 3:

size_t-The number of objects to be read in.

Argument 4:

FILE* restrict-A stream associated with the FILE* from which you want to read data from.

Example 1
  1    FILLER SOURCE CODE
FILLER TERMINAL