Freeze dynamic buffer and return pointer to it : ostrstream « File « C++






Freeze dynamic buffer and return pointer to it

  
#include <strstream>    
#include <iostream>   
using namespace std;
main()   
{   
  char *p;   
     
  ostrstream outs;  
     
  outs << "I like C++ ";   
  outs.setf(ios::showbase);   
  outs << 100 << ends;   
     
  p = outs.str();
     
  cout << p;   
     
  delete p;  
  return 0;   
}
  
    
  








Related examples in the same category

1.Display the contents of strin via calls to get()
2.use the contents of strout to create strin
3.construct a table of circular areas