Questions: 1. Explain stream classes for file operations with suitable diagram. 2. List the different stream classes supported in C++.
C++
Streams
•
The stream can represent file, console, block of memory or hardware device. The
iostream library provides the common set of functions for handling these
stream.

Fig. 6.2.1 Stream
•
The general representation is ‒

Fig. 6.2.2 Basic level of stream
class
•
The stream class hierarchy is divided
into three areas:
1.
A buffer system given by basic_streambuf
class. This class supports the basic low level input output operations. For
advanced I/O programming the basic_streambuf class is used directly.
2.
The specification system implemented by basic_ios
class. This is high level I/O to class that provides formatting, error
checking. basic_ios is used as a
base for several derived classes, classes, including basic_istream, basic_ostream and basic_iostream. These classes are used to create streams capable of
input, output and input/output, respectively.
3.
A translation system implemented by certain classes like istream, ostream,
iostream. This system converts the objects to a sequence of characters.
•
The classes like basic_streambuf or basic_ios are known as template classes.
From these template classes the 8‒bit character based classes are derived ‒
Template class : 8‒bit character class
basic_streambuf
: streambuf
basic_ios : ios
basic_istream
: istream
basic_ostream
: ostream
basic
iostream : iostream
basic_fstream
: fstream
basic_ifstream
: ifstream
basic_ofstream
: ofstream
•
This can be presented by following Fig. 6.2.3 of class hierarchy.

Fig. 6.2.3 Stream class hierarchy
Now
onwards the character class names will be used because these names are normally
used in the program.
Review Questions
1. Explain stream
classes for file operations with suitable diagram.
2. List the different
stream classes supported in C++.
Object Oriented Programming: Chapter 6: IO Systems and File IO : Tag: Oops, Computer Programming : C++ Object Oriented Programming - C++ Streams
Object Oriented Programming (OOPs)
CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation
English Essentials II
EN25C02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Tamils and Technology தமிழர்களும் தொழில்நுட்பமும்
UC25H02 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Linear Algebra
MA25C02 2nd Semester | 2025 Regulation
Applied Physics (CSIE) II
PH25C03 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Digital Principles and Computer Organization
CS25C06 2nd Semester AIDS, CSE, IT, CSE(CY) Dept | 2025 Regulation | 2nd Semester 2025 Regulation
Basic Electrical and Electronics Engineering
EE25C01 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Object Oriented Programming (OOPs)
CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation
Re-Engineering for Innovation
ME25C05 2nd Semester | 2025 Regulation | 2nd Semester 2025 Regulation
Object Oriented Programming (OOPs) - Laboratory
CS25C07 2nd Semester CSE, CSE(CY) Depts | 2025 Regulation | 2nd Semester 2025 Regulation