Partilhar via


basic_ostream::flush

Flushes the buffer.

basic_ostream<_Elem, _Tr>& flush( );

Return Value

A reference to the basic_ostream object.

Remarks

If rdbuf is not a null pointer, the function calls rdbuf->pubsync. If that returns -1, the function calls setstate(badbit). It returns *this.

Example

// basic_ostream_flush.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   cout << "test";
   cout.flush();
}
test

Requirements

Header: <ostream>

Namespace: std

See Also

Reference

basic_ostream Class

iostream Programming

iostreams Conventions

Other Resources

basic_ostream Members