Constructing Input Stream Objects

If you use only the cin object, you don’t need to construct an input stream. You must construct an input stream if you use:

Input File Stream Constructors

There are three ways to create an input file stream:

Input String Stream Constructors

Input string stream constructors require the address of preallocated, preinitialized storage:

char s[] = "123.45";
double amt;
istrstream myString( s );
myString >> amt; // Amt should contain 123.45