istream_withassign::operator =

istream& operator =( const istream& ris );

istream& operator =( streambuf* psb );

Remarks

The first overloaded assignment operator assigns the specified istream object to this istream_withassign object.

The second operator attaches a streambuf object to an existing istream_withassign object, and it initializes the state of the istream_withassign object. This operator is often used in conjunction with the void-argument constructor.

Example

char buffer[100];
class xistream; // A special-purpose class derived from istream
extern xistream xin; // An xistream object constructed elsewhere

cin = xin; // cin is reassigned to xin
cin >> buffer; // xin used instead of cin

Example

char buffer[100];
extern filedesc fd; // A file descriptor for an open file
filebuf fb( fd ); // Construct a filebuf attached to fd

cin = &fb;     // fb associated with cin
cin >> buffer; // cin now gets its intput from the fb file

istream_withassign OverviewInput Stream Classes

See Also   istream_withassign::istream_withassign