S
Syron
As the strings are separated by NUL chars and I simply assume that the final end of the char* will be marked by two NUL chars immediately following each other (thus the last string will be a "virtual" string with length 0), I suggest the following:
typedef std::vector<std::string> StringVec;
StringVec nulSplit(const char* input) {
StringVec result;
while(input[0] != 0) {
std::string token(input);
result.push_back(token);
input += token.length()+1; // +1 to skip NUL char
}
return result;
}
typedef std::vector<std::string> StringVec;
StringVec nulSplit(const char* input) {
StringVec result;
while(input[0] != 0) {
std::string token(input);
result.push_back(token);
input += token.length()+1; // +1 to skip NUL char
}
return result;
}