Managing Console Input Output Operations in C++ :– Every program takes some data as input and generates processed data as output from the familiar input process output cycle. Like this way c++ programming language provide this type facility. We have already use these operator these are the cin (<<) and cout (<< )operator. C++ support rich set of input and output operators and function since these function use the advanced features of c++ as like classes derived classes and virtual function.
C++ uses the concept of stream and stream classes to implementation i/o operation with the console and disk files.
C++ Streams -: The i/o system design to work with a wide variety of device including terminals disks and tape drives. Although each device is very different the i/o system supply and interface to the programmer that is independent to the actual device being accessed. this process called the stream .
A stream is sequence of bytes. It acts either as a source from which the input data can be obtained or as a destination to which the output data can be sent. This source stream that provide data to the program is called the input stream and the destination stream that receive output from the program is called the output stream.
In other words we can say that the a program extract the bytes from an input stream and inserts bytes into an output stream.
The data in the input stream can come from the keyword or any other storage devices. The data in the output stream can go to screen or any other storage devices .
A stream acts as an interface between the program and the input / output device. So a c++ program handles data independent of the device used. C++ several pre define stream some are already using as like
cin >>
cout <<
C++ Streams classes -: The c++ i/o system contains hierarchical of classes that are used to define various stream to deal with both the console and disk files. these classes are called the stream classes.