User Tools

Site Tools


c_-_c_streams:ostrstream

C - C++ Streams - ostrstream

#include <strstream>
#include <iostream>
using namespace std;
 
int main()
{
  char str[80];
 
  ostrstream outs(str, sizeof(str));
 
  outs << "abcdefg ";
  outs << 27 << " "  << 890.23;
  outs << ends;  // null terminate
 
  cout << outs.pcount(); // display how many chars in outs
 
  cout << " " << str;
 
  return 0;
}
c_-_c_streams/ostrstream.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki