what is the easiest way to copy a two-dimensional array of chars into a one-dimensional array of strings in c++?
something like that:
char inCharArray[3][255];
string outStringArray[3];
for (int i = 0; i < sizeof(inCharArray) / sizeof(inCharArray[i]); i++)
{
outStringArray[i] = inCharArray[i];
}
Regards Tillman
/*const*/std::string outStringArray[3]{inCharArray[0], inCharArray[1], inCharArray[2]};?/*const*/ std::vector<std::string> outStringArray(std::begin(inCharArray), std::end(inCharArray));?std::copy(std::begin(inCharArray), std::end(inCharArray), std::begin(outStringArray));?inCharArrayand answered withoutStringArray. Classic.