int sync();
Synchronizes the input buffer with the associated data source.
Behaves as UnformattedInputFunction, except that gcount() is not affected. After constructing and checking the sentry object,
if rdbuf() is a null pointer, returns -1.
Otherwise, calls rdbuf()->pubsync(). If that function returns -1, calls setstate(badbit) and returns -1. Otherwise, returns 0.
Parameters
(none).
Return value
0 on success, -1 on failure or if the stream does not support this operation