I am tokenizing a line using a stringstream and a vector but the stringstream seems to be repeating the first word, here's my code:
Here's an example input-output
Code:
std::stringstream ss;
std::vector<std::string> LineVec;
std::string Line, Word;
while(std::getline(File, Line)) {
if(Line.empty()) { continue; }
ss.str(Line);
ss.seekg(std::ios::beg);
while(ss >> Word) { LineVec.push_back(Word); }
//Un related stuff here
LineVec.clear();
}
Input: Hello, My name's MrPickle
Output: Hello, My name's MrPickle Hello,
Output: Hello, My name's MrPickle Hello,
Comment