- How to put char array into std::string
- char* value = new char[required];
- f(name, required, value, NULL); // fill the array
- strResult->assign(value, required);
- delete [] value;
- std::string strResult(required, ' ');
- f(name, required, &strResult[0], NULL);
- // optionally, to remove the extraneous trailing NUL (assuming f NUL-terminates):
- strResult.pop_back();
- return strResult;
- std::string s(charArry);