Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

cerr

 

The object cerr controls output to a stream buffer associated with the object stderr, declared in <cstdio>.

extern ostream cerr;

The object controls unbuffered insertions to the standard error output as a byte stream. Once the object is constructed, the expression cerr.flags & unitbuf is nonzero, and cerr.tie() == &cout.

Example

// iostream_cerr.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

using namespace std;

void TestWide( ) 
{
   int i = 0;
   wcout << L"Enter a number: ";
   wcin >> i;
   wcerr << L"test for wcerr" << endl;
   wclog << L"test for wclog" << endl;   
}

int main( ) 
{
   int i = 0;
   cout << "Enter a number: ";
   cin >> i;
   cerr << "test for cerr" << endl;
   clog << "test for clog" << endl;
   TestWide( );
}

3
1

Enter a number: 3
test for cerr
test for clog
Enter a number: 1
test for wcerr
test for wclog

Requirements

Header: <iostream>

Namespace: std

Show: