ostream_withassign::operator =

Syntax

ostream& operator =( ostream& ros );

ostream& operator =( streambuf* sbp );

Remarks

The first overloaded assignment operator assigns the specified ostream object to this ostream_withassign object.

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

Example

filebuf fb( "test.dat" ); // Filebuf object attached to "test.dat"

cout = &fb; // fb associated with cout

cout << "testing"; // Message goes to "test.dat" instead of stdout

See Also

ostream_withassign::ostream_withassign, cout