Michaels-MacBook-Pro:~ mjbshaw$ cat t.cpp
#include <iostream>
#include <sstream>
int main()
{
std::stringstream ss;
for (int i = 0; i < 20000; ++i)
ss << i << '\n';
std::string str = ss.str();
std::cout << "There are " << str.size() << " characters in ss and str\n";
std::cout << "The contents of ss and str are:\n" << str;
}
Michaels-MacBook-Pro:~ mjbshaw$ g++ t.cpp && ./a.out
There are 108890 characters in ss and str
The contents of ss and str are:
0
1
2
3
4
[...] (I'm not going to post all 20,000 numbers)
Seems to work just fine for me... I got 108,890 characters in ss and str...