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!
Code:std::ifstream keywords("keywords.txt", std::ios::in); if (keywords.is_open()) { std::string line, fmtkey; std::stringstream format; 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; special.push_back(stringpair(fmtkey, line)); } keywords.close(); }



LinkBack URL
About LinkBacks


