Coupon Accepted Successfully!


Pre-Defined Streams

C++ has a number of pre-defined streams. These pre-defined streams are also called as standard I/O objects. These streams are automatically activated when program execution starts. Table describes the pre-defined streams.

Table: Pre-defined C++ Stream or I/O Global Objects



Standard input, usually keyboard, corresponding to stdin in C. It handles input from input devices usually from keyboard.


Standard output, usually screen, corresponding to stdout in C. It passes data to output devices such as monitors and printers. Thus, it controls output.


A fully buffered version of cerr (no C equivalent). It controls error messages that are passed from buffer to the standard error device.


Standard error output, usually screen, corresponding to stderr in C. It controls the unbuffered output data. It catches the errors and passes to standard error device monitor.

3.1 Write a program to display a message using pre-defined objects.



Explanation: In this program the pre-defined objects cout, cerr, and clog are used to display the message “STREAMS” on the screen.

Test Your Skills Now!
Take a Quiz now
Reviewer Name