Perform both input and output with strstream : strstream « File Stream « C++ Tutorial






#include <iostream>   
#include <strstream>   
using namespace std;
main()   
{   
  char iostr[80];   
     
  strstream ios(iostr, sizeof(iostr), ios::in | ios::out);   
     
  int a, b;   
  char str[80];   
     
  ios << "1734 534abcdefghijklmnopqrstuvwxyz";   
  ios >> a >> b >> str;   
  cout << a << " " << b << " " << str << endl;   
     
}








12.21.strstream
12.21.1.Perform both input and output with strstream
12.21.2.Perform both input and output