std::basic_ostream::flush
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> basic_ostream& flush(); |
||
Écrit les modifications non validées à la séquence de sortie sous-jacente .
Original:
Writes uncommitted changes to the underlying output sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Si rdbuf () est un pointeur NULL, ne fait rien
Original:
If rdbuf() is a null pointer, does nothing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Sinon, construit un objet sentry qui vérifie le flux d'erreurs et les couleurs de la cravate () 'flux de sortie d. Si l'objet sentinelle retourne
false, ne (depuis C++11) rienOriginal:
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 (depuis C++11)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Dans le cas contraire, les appels
rdbuf()->pubsync(). Si les retours d'appels -1, appelle setstate(badbit) .Original:
Otherwise, calls
rdbuf()->pubsync(). If the call returns -1, calls setstate(badbit).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Paramètres
(Aucun)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Retourne la valeur
*this
Exceptions
Peut générer std::ios_base::failure si
exceptions()&badbit!=0 .Original:
May throw std::ios_base::failure if
exceptions()&badbit!=0.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#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();
}
Résultat :
Output from main
Output from thread.....thread calls flush()
Voir aussi
synchronise avec le dispositif de stockage sous-jacent 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. (fonction membre publique de std::basic_istream)
| |
vide le flux de sortie 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. (fonction générique) | |
sorties '\n' et vide le flux de sortieOriginal: outputs '\n' and flushes the output streamThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction générique) | |