Click to See Complete Forum and Search --> : Creating a stringbuffer...


Josh man
July 16th, 2002, 12:12 PM
How do you create a buffer where i can add charachters to the buffer. I then want to put this sequence of characters (the buffer) into an element of an array and then put this array into an element of a vector?

jfaust
July 16th, 2002, 12:19 PM
Well, to start you out, you can use ostringstream.


#include <sstream>
using namespace std;

...


ostringstream ostr;
ostr << "The answer is..." << 42 << endl;

string strAnswer = ostr.str();



Now, I'm sure there's an easy way to get it into a vector, although I've never done it.

Jeff