Writes binary data to a stream.
#include <stdio.h> size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
ptr
A pointer to the array to write to the stream.
size
The size of an array element, in characters.
nmemb
The maximum number of elements to write.
stream
A pointer to a file stream.
The fwrite() function writes nmemb items of size bytes each to stream. The items are contained in the array pointed to by ptr. After writing the array to stream, fwrite() advances the file position indicator accordingly.
If the file is opened in update mode (+) the file cannot be written to and then read from unless the write operation and read operation are separated by an operation that flushes the stream's buffer. This can be done with the fflush() function or one of the file positioning operations ( fseek(), fsetpos(), or rewind()).
This facility may have limited capability on configurations of the EWL that run on platforms that do not have console input/output or a file system. fwrite() returns the number of items successfully written to stream.