What do you mean by token? If this is something separated by spaces, line streams are what you want:
std::istringstream iss("blah wrxgl bxrcy") for(;;) { std::string token; if(!(iss>>token)) break; process(token); } if(!iss.eof()) report_error();
Alternatively, if you are looking for a separate separator character, you can replace iss>>token with std::getline(iss,token,sep_char) .
If it is more than one character that can act as a delimiter (and if it is not spaces), use combinations of std::string::find_first() and std::string::substr() .
sbi
source share