protected virtual member function
<fstream>

std::basic_filebuf::sync

int sync();
Synchornize buffer
Synchronizes the intermediate buffers with the associated file:

If an intermediate output buffer exists (as defined by pptr, epptr and pback), its contents are written to the file (as if basic_filebuf::overflow was called).

If an intermediate input buffer exists, the effects -if any- depend on the library implementation.

This virtual member function overrides the inherited member basic_streambuf::sync, called by member pubsync to synchronize the buffers.

Parameters

none

Return Value

If successful, it returns zero.
Otherwise, it returns -1 to indicate failure.

Data races

Modifies the basic_filebuf object.
Concurrent access to the same file stream buffer object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.

See also