fwrite
- Updated2023-02-21
- 1 minute(s) read
fwrite
size_t fwrite (const void *buffer, size_t elementSize, size_t numberOfElements, FILE *stream);
Purpose
Writes a block of data to the specified output stream. The data to be written is stored in the specified buffer and the number of elements successfully written is returned. The function advances the file position indicator by the number of characters successfully written.
Parameters
Input | ||
Name | Type | Description |
buffer | const void * | Contains a pointer to the data block written to the specified output stream. |
elementSize | size_t | Specifies the size in bytes of the elements to be written. |
numberOfElements | size_t | Specifies the number of elements to be written. If a write error is encountered, the number of elements actually written can be less than the number specified by this parameter. |
stream | FILE * | Specifies the output stream to which data will be written. |
Return Value
Name | Type | Description |
elementsWritten | size_t | Contains the number of elements successfully written. If a write error is encountered, the returned value can be less than that specified in the number_ofElements parameter. If an error occurs, fwrite sets errno to a nonzero value. |
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later