protected virtual member function
<streambuf> <iostream>


int sync();
Synchronize stream buffer
Virtual function called by the public member function pubsync to synchronize the contents in the buffer with those of the associated character sequence.

Its default behavior in basic_streambuf is to do nothing and return zero (indicating success), but derived classes that use intermediate buffers shall override this behavior to properly synchronize them: basic_filebuf overrides this virtual member function (see basic_filebuf::sync).



Return Value

Returns zero, which indicates success.
A value of -1 would indicate failure.

Data races

Introduces no data races, but overriden versions in derived classes may.

Exception safety

No-throw guarantee: this default definition never throws exceptions.

See also