std::ios_base::sync_with_stdio

Sets whether the standard C++ streams are synchronized to the standard C streams after each input/output operation.

# Declarations

static bool sync_with_stdio( bool sync = true );

# Parameters

# Return value

Synchronization state before the call to the function.

# Example

#include <cstdio>
#include <iostream>
 
int main()
{
    std::ios::sync_with_stdio(false);
    std::cout << "a\n";
    std::printf("b\n");
    std::cout << "c\n";
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 49C++98it was unspecified (1) which state is actually returned and(2) what does ‘synchronized’ between standard C and C++ streams meanboth specified

# See also