A dynamic output array : Array Based IO « File « C++






A dynamic output array

A dynamic output array


#include <strstream>
#include <iostream>
using namespace std;
int main()
{
  char *p;
  ostrstream outs;                       // dynamically allocate array
  outs << "C++ array-based I/O ";
  outs << -10 << hex << " ";
  outs.setf(ios::showbase);
  outs << 100 << ends;
  p = outs.str();                        // Freeze dynamic buffer and return
                                         // pointer to it.
  cout << p;
  return 0;
}


           
       








Related examples in the same category

1.Using Binary I/O with Array-Based StreamsUsing Binary I/O with Array-Based Streams
2.An array-based output streamAn array-based output stream