Espaces de noms
Variantes
Affichages
Actions

std::cerr, std::wcerr

De cppreference.com
< cpp‎ | io

 
 
D'entrée / sortie de bibliothèque
I / O manipulateurs
C-style I / O
Tampons
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf (obsolète)
Cours d'eau
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstractions
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Fichier E / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
Chaîne I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Tableau I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream (obsolète)
ostrstream (obsolète)
strstream (obsolète)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Interface catégorie d'erreur
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category (C++11)
io_errc (C++11)
 
std::basic_ostream
Les objets globaux
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cerr
wcerr
Les fonctions membres
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::basic_ostream
basic_ostream::~basic_ostream
basic_ostream::operator= (C++11)
Entrée formaté
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::operator<<
Entrée non formaté
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::put
basic_ostream::write
Positionnement
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::tellp
basic_ostream::seekp
Divers
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::flush
basic_ostream::swap (C++11)
Classes de membres
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostream::sentry
Tiers fonctions
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator<<(std::basic_ostream)
 
Defined in header <iostream>
extern std::ostream cerr;
(1)
extern std::wostream wcerr;
(2)
Les objets globaux et std::cerr std::wcerr sortie de commande à une mémoire tampon de flux de type défini par l'application (extraite de std::streambuf et std::wstreambuf, respectivement), associé au flux de sortie d'erreur standard C stderr .
Original:
The global objects std::cerr and std::wcerr control output to a stream buffer of implementation-defined type (derived from std::streambuf and std::wstreambuf, respectively), associated with the standard C error output stream stderr.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ces objets sont garantis d'être construits avant le premier constructeur d'un objet statique est appelé et ils sont garantis pour survivre à la dernière destructeur d'un objet statique, de sorte qu'il est toujours possible d'écrire à std::cerr dans le code utilisateur .
Original:
These objects are guaranteed to be constructed before the first constructor of a static object is called and they are guaranteed to outlive the last destructor of a static object, so that it is always possible to write to std::cerr in user code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Sauf sync_with_stdio(false) a été délivré, il est sûr d'accéder simultanément à ces objets à partir de plusieurs threads à la fois pour une sortie formatée et non formaté .
Original:
Unless sync_with_stdio(false) has been issued, it is safe to concurrently access these objects from multiple threads for both formatted and unformatted output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Une fois initialisé, std::cerr.flags() & unitbuf != 0 (même pour wcerr) ce qui signifie que toute sortie est envoyée à ces objets de flux est immédiatement rincé à l'OS (via destructeur de std::basic_ostream::sentry) .
Original:
Once initialized, std::cerr.flags() & unitbuf != 0 (same for wcerr) meaning that any output sent to these stream objects is immediately flushed to the OS (via std::basic_ostream::sentry's destructor).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
En outre, les rendements std::cerr.tie() &std::cout (même pour wcerr et wcout), ce qui signifie que toute opération de sortie sur std::cerr exécute d'abord std::cout.flush() (via un constructeur de std::basic_ostream::sentry) (depuis C++11)
Original:
In addition, std::cerr.tie() returns &std::cout (same for wcerr and wcout), meaning that any output operation on std::cerr first executes std::cout.flush() (via std::basic_ostream::sentry's constructor) (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.

[modifier] Exemple

sortie vers stderr par bouffées cerr sur la sortie en attendant le cout, tandis que la production vers stderr par sabot ne fonctionne pas
Original:
output to stderr via cerr flushes out the pending output on cout, while output to stderr via clog does not
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#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()" << std::endl;
}
 
int main()
{
    std::thread t1(f);
    std::this_thread::sleep_for(std::chrono::seconds(1));
    std::clog << "This output from main is not tie()'d to cout\n";
    std::cerr << "This output is tie()'d to cout\n";
    t1.join();
}

Résultat :

This output from main is not tie()'d to cout
Output from thread...This output is tie()'d to cout
...thread calls flush()

[modifier] Voir aussi

initialise les objets de flux standard
Original:
initializes standard stream objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(classe membre publique de std::ios_base) [edit]
écrit à la norme C stderr
(
objet global
Original:
global object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
)
flux d'erreur
Original:
writes to the standard C error stream stderr
(
objet global
Original:
global object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]
écrit à la norme C stdout
(
objet global
Original:
global object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
)
flux de sortie
Original:
writes to the standard C output stream stdout
(
objet global
Original:
global object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]