MicrOS
fwrite.c File Reference
#include "../stdio.h"

Functions

size_t fwrite (const void *ptr, size_t size, size_t count, FILE *stream)
 Write block of data to stream. More...
 

Function Documentation

◆ fwrite()

size_t fwrite ( const void *  ptr,
size_t  size,
size_t  count,
FILE stream 
)

Write block of data to stream.

Writes an array of count elements, each one with a size of size bytes, from the block of memory pointed by ptr to the current position in the stream. The position indicator of the stream is advanced by the total number of bytes written.

Parameters
ptrPointer to a block of memory with a size of at least (size*count) bytes, converted to a void*.
sizeSize, in bytes, of each element to be read.
countNumber of elements, each one with a size of size bytes.
streamPointer to a FILE object that identifies the stream to be closed.
Returns
The total number of elements successfully written is returned. If this number differs from the count parameter, a writing error prevented the function from completing. In this case, the error indicator will be set for the stream.