public static member function
bool sync_with_stdio ( bool sync = true );

Activate/deactivate synchronization of iostream and cstdio streams [static]

Toggles on or off synchronization of the iostream standard streams with the standard C streams.

When syncronization is on, the iostream standard stream objects (cin, cout, cerr, clog, and their wide versions wcin, wcout, wcerr and wclog) are synchronized with their C standard counterparts: stdin, stdout and stderr.

With stdio synchronization turned off, iostream standard stream objects may operate independently of the standard C streams.

By default, the standard iostream and cstdio streams are synchronized.

Notice that this is a static member function, therefore a call to this function using the member of any object (or of any related class) toggles on or off synchronization for all standard iostream objects.


Boolean parameter indicating whether synchronization is to be turned on or off: With a value of true it turns synchronization on, while a value of false turns it off.

Return Value

Returns the synchronization state that was set before the call.