Listing 10 Writes to a string stream

// incore.cpp: Incore formatting
#include <iostream.h>
#include <strstream.h>
#include <stddef.h>

main()
{
   const size t BUFSIZ = 128;
   char s[BUFSIZ];
   int i;

   cout << "Please enter an integer: ";
   cin >> i;
   ostrstream(s,sizeof s) << 'You entered "<< i << ends;
   cout << "s == \"" << s << "\"\n";
   return 0;
}

// Sample Execution
// Please enter an integer: 10
// s == "You entered 10"

// End of File