Namespaces
Variants
Views
Actions

std::fwrite

From cppreference.com
< cpp‎ | io‎ | c
Revision as of 18:57, 2 November 2012 by P12bot (Talk | contribs)

 
 
 
 
Defined in header <cstdio>
int fwrite( const void* buffer, std::size_t size, std::size_t count, std::FILE* stream );

Writes up to count objects from the given array buffer to the output stream stream as if by reinterepreting each object as an array of unsigned char and calling std::fputc size times for each object to write those unsigned chars into stream, in order. The file position indicator for the stream is advanced by the number of characters written.

If the objects are not TriviallyCopyable, the behavior is undefined.

If an error occurs, the resulting value of the file position indicator for the stream is indeterminate.

Contents

Parameters

buffer - pointer to the first object object in the array to be written
size - size of each object
count - the number of the objects to be written

Return value

Number of objects written successfully, which may be less than count if an error occurred.

If size or count is zero, fwrite returns zero and performs no other action.

Example

See also

Template:cpp/io/c/dcl list fprintfTemplate:cpp/io/c/dcl list fputsTemplate:cpp/io/c/dcl list fread
C documentation for fwrite