Writing a file using fwrite fwrite is defined as. int fwrite ( const void * array, size_t size, size_t count, FILE * stream ); fwrite function writes a block of data to the stream. It will write an array of count elements to the current position in the stream. For each element, it will write size bytes.