freeze

Freezes the dynamic allocation or destruction of a buffer.

If N is nonzero (the default), the string associated with this `ostrstream' should be declared not to change dynamically. While frozen, the string will not be reallocated if it needs more space, and will not be deallocated when the ostrstream is destroyed.

void ostrstream::freeze ([int N])

Remarks

This member function calls rdbuf()-> freeze(freezeit).

Listing: Example of ostrstream freeze() usage.
#include <iostream>
#include <strstream>

int main()
{
   ostrstream out;
   out   << "CodeWarrior " << 1234;
   out <<   "the size of the array so far is "
      << out.pcount() <<   " characters \n";
   out   << " Software" << '\0';
   out.freeze();      // freezes so no more growth can occur
   out   << " at work" << ends;
   out <<   "the final size of the array   is " 
      <<out.pcount() <<   " characters \n";

   cout << out.str() << endl;
   return 0;
}