I can copy some ostringstream into a new char array like this:
std::ostringstream stream;
...
std::string str = stream.str();
size_t size = str.size();
char *target = new char[size];
memcpy(target,str.c_str(),size);
How about the performance? Is there a way to copy the data directly to the array Buffer?
I think it will look like:
size_t size = str.tellp();
char *target = new char[size];
stream.copyTo(target,size); //??