1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
// ostringstream::rdbuf
#include <string> // std::string
#include <iostream> // std::cout
#include <sstream> // std::ostringstream, std::stringbuf
int main () {
std::ostringstream oss;
// using stringbuf directly
std::stringbuf *pbuf = oss.rdbuf();
pbuf->sputn ("Sample string",13);
std::cout << pbuf->str();
return 0;
}
|