bool sync_with_stdio(bool sync = true);
Returns: true if the previous state of the standard iostream objects ([iostream.objects]) was synchronized and otherwise returns false. The first time it is called, the function returns true.
When a standard iostream object str is synchronized with a standard stdio stream f, the effect of inserting a character c by
fputc(f, c);
is the same as the effect of
str.rdbuf()->sputc(c);
for any sequences of characters; the effect of extracting a character c by
c = fgetc(f);
is the same as the effect of
c = str.rdbuf()->sbumpc();
for any sequences of characters; and the effect of pushing back a character c by
ungetc(c, f);
is the same as the effect of
str.rdbuf()->sputbackc(c);
for any sequence of characters.299
This implies that operations on a standard iostream object can be mixed arbitrarily with operations on the corresponding stdio stream. In practical terms, synchronization usually means that a standard iostream object and a standard stdio object share a buffer.