Basically, when print something to the stringstream and later extract it it still remains in the stringstream. I want to flush the stream so the next insertion I make will only be extracted.
stringstream::flush() isn't working. Please help!
std::ifstream keywords("keywords.txt", std::ios::in);
std::string line, fmtkey;
while (std::getline(keywords, line))
format << ' ' << line << ' ';
format >> fmtkey;
// How do I flush the entire stream? Contents from last insertion/extraction still remain
format << "<layer class=\"keyword\"> " << line << " </layer>";
format >> line;