std::basic_ostream::flush
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
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 (dal C++11)
Otherwise, calls rdbuf()->pubsync(). If the call returns -1, calls setstate(badbit).
Indice |
[modifica] Parametri
You can help to correct and verify the translation. Click here for instructions.
[modifica] Valore di ritorno
*this
[modifica] Eccezioni
May throw std::ios_base::failure if exceptions()&badbit!=0.
[modifica] Esempio
#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(); }
Output:
Output from main Output from thread.....thread calls flush()
[modifica] Vedi anche
sincronizza con il dispositivo di archiviazione sottostante 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. (metodo pubblico) | |
svuota il flusso di output 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. (funzione di modello) | |
uscite '\n' e colori nel flusso di output 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. (funzione di modello) |