Contents|Index|Previous|Next

Managing input streams: class istream

Class istream objects are specialized for input; as for ostream, they are derived from ios, so you can use any of the general-purpose methods from that base class. Declarations for this class also come from iostream.h.

See the following documentation’s discussion for more information.

- Reading one character
- Reading strings
- Repositioning an istream
- Miscellaneous istream utilities

    istream::istream ()
    Constructor

When used without arguments, the istream constructor simply initializes the ios object and initializes the input counter (the value reported by istream::gcount) to 0.

    istream::istream (streambuf* sb [, ostream tie])
    Constructor

You can also call the constructor with one or two arguments. The first argument, sb, is a streambuf*; if you supply this pointer, the constructor uses that streambuf for input. You can use the second optional argument tie to specify a related output stream as the initial value for ios::tie.

If you use this constructor, the argument, sb, is not destroyed (or deleted or closed) when the ostream is destroyed.