Espacios de nombres
Variantes

std::basic_ostream<CharT,Traits>::flush

De cppreference.com
 
 
Biblioteca de E/S
Manipuladores de E/S
E/S estilo C
Búferes
(en desuso en C++98)
Flujos
Abstracciones
E/S de archivos
E/S de cadenas
E/S de arrays
(en desuso en C++98)
(en desuso en C++98)
(en desuso en C++98)
Salida sincronizada
Tipos
Interfaz de categoría de error
(C++11)
 
 
<tbody> </tbody>
basic_ostream& flush();

Writes uncommitted changes to the underlying output sequence.

If rdbuf() is a null pointer, does nothing

Otherwise, constructs a sentry object which checks the stream for errors and flushes the tie()'d output streams. If the sentry object returns false, does nothing (desde C++11)

Otherwise, calls rdbuf()->pubsync(). If the call returns -1, calls setstate(badbit).

Parámetros

(Ninguno)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Valor de retorno

*this

Excepciones

May throw std::ios_base::failure if exceptions()&badbit!=0.

Ejemplo

#include <thread>
#include <iostream>
#include <chrono>
void f()
{
    std::cout << "Output from thread...";
    std::this_thread::sleep_for(std::chrono::seconds(2));
    std::cout << "...thread calls flush()\n";
    std::cout.flush();
}

int main()
{
    std::thread t1(f);
    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::clog << "Output from main\n";
    t1.join();
}

Salida:

Output from main
Output from thread.....thread calls flush()

Ver también

sincroniza con el dispositivo de almacenamiento subyacente
Original:
synchronizes with the underlying storage device
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función miembro pública de std::basic_istream) [editar]
vacía el flujo de salida
Original:
flushes the output stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(plantilla de función)
salidas '\n' y los colores de la secuencia de salida
Original:
outputs '\n' and flushes the output stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(plantilla de función)