Chapter-10 - OOPC IO Operation
Chapter-10 - OOPC IO Operation
I/O Operations
Weightage: 5%
Hours: 2 Hours needed
ostream Output stream It can write sequences of characters and represents other kinds of data.
ifstream Input File Stream The ifstream class is derived from fstreambase and istream by multiple inheritance.
This class accesses the member functions such as get(), getline(), seekg(), tellg()
and read().
It provides open() function with the default input mode and allows input operations.
ofstream Output File Stream The ofstream class is derived from fstreambase and ostream classes.
This class accesses the member functions such as put(), seekp(), write() and
tellp().
It provides the member function open() with the default output mode.
fstream File Stream The fstream allows input and output operations simultaneous on a filebuf.
It invokes the member function istream::getline() to read characters from the file.
This class provides the open() function with the default input mode.
fstreambase File Stream Base It acts as a base class for fstream, ifstream and ofstream. The open() and close()
functions are defined in fstreambase.
• The key point to remember is that the write() function does not stop displaying the string
automatically when a NULL character occurs. If the size is greater than the length of the
line then, the write() function displays beyond the bound of the line.