std::ios_base::sync_with_stdio

From Cppreference

Jump to: navigation, search
static bool sync_with_stdio( bool sync = true );

Sets whether the standard std::cin, std::cout, std::cerr, std::clog, std::wcin, std::wcout, std::wcerr and std::wclog C++ streams are synchronized to the standard stdin, stdout, stderr and stdlog C streams after each input/output operation. If the synchronization is turned off, the C++ standard streams are allowed to act independently. In this case using both C and C++ standard streams at the same time leads to undefined behavior. If the synchronization is turned on, the performance of the C++ standard streams is degraded.

By default, the C++ streams are synchronized with the C streams.

[edit] Parameters

sync - the new synchronization setting

[edit] Return value

synchronization state before the call to the function

[edit] Example