Utility Functions and C Language Reference > C Language Reference > Alphabetical List of Functions > fread

fread

Example: fread Input-Output Functions

Reads unformatted data from a stream into a buffer.

size_t fread( void *buffer, size_t size, size_t count, FILE *file_pointer);

buffer The buffer in which to store the data stream.
size The size of the buffer.
count The number of bytes to read.
file_pointer A pointer to a file.

Return Values

Returns the Total number of items read. If this number differs from the requested amount (count parameter) an error has occurred or End Of File has been reached. To determine what happened, call feof or ferror.