Lorem ipsum dolor sit amet, consectetur adipiscing elit. Test link
Posts

5.3 cerr (error stream)

1 min read
Image result for cerr (error stream) C++


The predefined object cerr is an instance of iostream class. The cerr object is said to be attached to the standard error device, which is also a display screen but the object cerr is un-buffered and each stream insertion to cerr causes its output to appear immediately.

The cerr is also used in conjunction with the stream insertion operator as shown in the following example.
int main( )
{
char str[] = "Unable to read....";
cerr << "Error message : " << str << endl;
}

When the above code is compiled and executed, it produces the following result:
Error message : Unable to read....

                        5.4 clog (log stream)           NEXT >>

You may like these posts

  • refers to where variables is declared. It can be Inside a function or a block which is called local variables, In the definition of function parameters which is called f…
  •    A variable in C++ is a name for a piece of memory that can be used to store information. There are many types of variables, which determines the size and la…
  •   An operator is a symbol. Compiler identifies Operator and performs specific mathematical or logical operation. C provides following operators : # Arithmetic Operators # L…
  • auto The default class. Automatic variables are local to their block. Their storage space is reclaimed on exit from the block. register If possible, the variable will be…
  • Array is a fixed size collection of similar data type items. Arrays are used to store and access group of data of same data type. Arrays can of any data type. Arrays must…
  • /* This Program prints Hello World on screen */ #include <iostream.h> using namespace std; int main () { cout << "Hello World!"; return 0; } 1 . /* This program ..…

Post a Comment