|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Writes data to a stream.
size_t fwrite( const void *buffer, size_t size, size_t count, FILE *stream );
- Pointer to data to be written.
- Item size in bytes.
- Maximum number of items to be written.
- Pointer to FILE structure.
fwrite returns the number of full items actually written, which may be less than count if an error occurs. Also, if an error occurs, the file-position indicator cannot be determined.
The fwrite function writes up to count items, of size length each, from buffer to the output stream. The file pointer associated with stream (if there is one) is incremented by the number of bytes actually written. If stream is opened in text mode, each carriage return is replaced with a carriage-return – linefeed pair. The replacement has no effect on the return value.
|fwrite||<stdio.h>||ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP|
For additional compatibility information, see Compatibility in the Introduction.
All versions of the C run-time libraries.
See the example for fread.