Stream


  • A Stream is a general name given to a flow of data.
  • Each stream is associated with a particular class, which contains member functions and definitions for dealing with that particular kind of data flow.
  • Stream Class Hierarchy: The ios class is the base class. It contains many constants and member functions common to input and output operations.
  • E.g. showpoint and fixed flags used for numeric output. The ios class derives two classes - istream and ostream.
  • The istream class includes all functions for input of data.
  • It includes member functions like get(), getline(), read().
  • The overloaded extraction operator>> is a member of the istream class.

  • The cin object, representing the standard input stream, usually directed from the keyboard, is a predefined object of the istream_withassign class, which is derived from the istream class.
  • The ostream class includes all functions for output of data.
  • It includes member functions like put(), putline() and write().
  • The overloaded insertion operator << is a member of the ostream class.
  • The cout object, representing the standard output stream, usually directed to the video display, is a predefined object of the ostream_withassign class, which is derived from the ostream class.

  • The iostream class is derived from both istream and ostream class by multiple inheritance.
  • The iostream_withassign class is derived from iostream class.
  • The classes used for input and output to the video display and keyboard are declared in the header file iostream.h.
  • The classes used for disk I/O are included in the file fstream.h.
  • fstream.h incorporates iostream.h. Therefore, you need not explicitly open iostream.h.
  • The hierarchy of the classes included in the iostream and fstream classes is shown in the form of a diagram.


  • ASCII files are those files created by storing each character. They can also be called as text files.
  • Binary files are those files created by storing a block of memory (array of structure or class) . These are also called non-ASCII files.

    Graphics<< Previous
    Next >> Manipulating ASCII files

    Our aim is to provide information to the knowledge seekers. 


    comments powered by Disqus




Footer1