Mega Code Archive

 
Categories / C++ Tutorial / File Stream
 

Check how many characters are stored in ostrstream

#include <strstream>     #include <iostream>    using namespace std; main()    {      char str[80];            ostrstream outs(str, sizeof(str));            outs << "Hello ";      outs << 34 << " " << 1234.23;      outs << ends;           cout << outs.pcount(); // display how many chars in outs            cout << " " << str;            return 0;    }