istream
#include <iostream.h>
The istream class provides the basic capability for sequential and random-access input. An istream object has a streambuf-derived object attached, and the two classes work together; the istream class does the formatting, and the streambuf class does the low-level buffered input.
You can use istream objects for sequential disk input if you first construct an appropriate filebuf object. More often, you will use the predefined stream object cin (which is actually an object of class istream_withassign), or you will use objects of classes ifstream (disk file streams) and istrstream (string streams).
Derivation
It is not always necessary to derive from istream to add functionality to a stream; consider deriving from streambuf instead, as illustrated in Deriving Your Own Stream Classes. The ifstream and istrstream classes are examples of istream-derived classes that construct member objects of predetermined derived streambuf classes. You can add manipulators without deriving a new class.
If you add new extraction operators for a derived istream class, then the rules of C++ dictate that you must reimplement all the base class extraction operators. See the “Derivation” section of class ostream for an efficient reimplementation technique.
Construction/Destruction — Public Members
Constructs an istream object attached to an existing object of a streambuf-derived class.
Destroys an istream object.
Prefix/Suffix Functions — Public Members
Check for error conditions prior to extraction operations (input prefix function).
Called after extraction operations (input suffix function).
Input Functions — Public Members
Extracts characters from the stream up to, but not including, delimiters.
Extracts characters from the stream (extracts and discards delimiters).
Extracts data from the stream.
Extracts and discards characters.
Returns a character without extracting it from the stream.
Counts the characters extracted in the last unformatted operation.
Extracts leading white space.
Other Functions — Public Members
Puts characters back to the stream.
Synchronizes the stream buffer with the external source of characters.
Changes the stream’s get pointer.
Gets the value of the stream’s get pointer.
Operators — Public Members
Extraction operator for various types.
Protected Members
Constructs an istream object.
Manipulators
Extracts leading white space.
See Also streambuf, ifstream, istrstream, istream_withassign