iostream::iostream [constructor]
explicit  iostream (streambuf * sb);
iostream
  cplusplus.com  

Construct an object.
  Sets the initial values to inherited class members.
  This is done by calling inherited function:
   init(sb)

Parameters.

sb
pointer to a streambuf object.

Return Value.
  None (constructor).

Example.

// ostream constructor
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  filebuf fb;
  fb.open ("test.txt",ios::in|ios::out);
  iostream ios(&fb);
  ios << "Test sentence\n";
  fb.close();
  return 0;
}
  This code uses a filebuf object (derived from streambuf) to open the file test.txt. The buffer is passed as parameter to the iostream constructor, associating it to the stream.
  You will seldom construct iostream objects directly like in the previous example, you will rather use objects of derived classes like fstream, stringstream or your own ones.

Basic template member declaration ( basic_iostream<charT,traits> ):
explicit basic_iostream ( basic_streambuf<charT,traits>* sb );

See also.
  ios::init
  iostream class


© The C++ Resources Network, 2001