Namespace
Varianti

std::cerr, std::wcerr

Da cppreference.com.
< cpp‎ | io

 
 
Ingresso / libreria di output
I / O manipolatori
C-style I / O
Buffer
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(deprecato)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Astrazioni
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
File I / 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
String 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
Array 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(deprecato)
ostrstream(deprecato)
strstream(deprecato)
Tipi
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
Errore categoria interfaccia
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
Gli oggetti globali
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
Membri funzioni
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)
Ingresso formattato
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<<
Ingresso non formattato
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
Posizionamento
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
Varie
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)
Membri classi
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
Non membri funzioni
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)
Gli oggetti globali std::cerr e std::wcerr uscita di controllo ad un buffer del flusso di attuazione tipo definito (derivato da std::streambuf e std::wstreambuf, rispettivamente), associato al flusso di output di errore standard di 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.
Questi oggetti sono garantiti per essere costruito prima del primo costruttore di un oggetto statico viene chiamato e sono garantiti per sopravvivere distruttore ultimo di un oggetto statico, in modo che sia sempre possibile scrivere std::cerr nel codice utente.
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.
A meno che sync_with_stdio(false) è stato rilasciato, è sicuro per accedere a questi oggetti contemporaneamente da più thread sia per l'output formattato e non formattati.
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.
Una volta inizializzato, std::cerr.flags() & unitbuf != 0 (lo stesso per wcerr) il che significa che ogni uscita inviata a questi oggetti flusso viene immediatamente scaricato sul sistema operativo (tramite distruttore std::basic_ostream::sentry di).
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.
Inoltre, std::cerr.tie() torna &std::cout (uguale per wcerr e wcout), il che significa che qualsiasi operazione di uscita sul std::cerr eseguito per primo std::cout.flush() (tramite il costruttore di std::basic_ostream::sentry) (dal 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) (dal C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Esempio

output stderr con vampate cerr fuori l'uscita in attesa di cout, mentre la produzione di stderr tramite zoccolo non lo fa
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();
}

Output:

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

[modifica] Vedi anche

inizializza oggetti stream 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.

(membro pubblico of std::ios_base classe) [edit]
scrive allo standard stderr
(oggetto globale) flusso di errore C
Original:
writes to the standard C error stream stderr
(oggetto globale)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]
scrive nel flusso di output standard di stdout
(oggetto globale) C
Original:
writes to the standard C output stream stdout
(oggetto globale)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]