#include <stdio.h>
size_t fread(void *ptr, size_t size, size_t nitems, FILE *stream);
size_t fwrite(const void *ptr, size_t size, size_t nitems, FILE *stream);
MT-Safe
fwrite() writes to the named output stream at most nitems items of data from the array pointed to by ptr, where an item of data is a sequence of bytes (not necessarily terminated by a null byte) of length size. fwrite() stops writing when it has written nitems items of data or if an error condition is encountered on stream. fwrite() does not change the contents of the array pointed to by ptr. fwrite() increments the data-pointer in stream by the number of bytes written. fwrite() returns the number of items written.
If size or nitems is 0, then fread() and fwrite() return 0 and do not effect the state of stream.
The ferror() or feof() routines must be used to distinguish between an error condition and end-of-file condition.