Format is this:
name < value > ... ;
But when I run the following code:
Expand|Select|Wrap|Line Numbers
- std::string token;
- while (is >> token && token != ";")
- {
- if (valMap.find(token)!=valMap.end())
- {
- std::string dump;
- is >> dump;
- assert (dump == "<");
- is >> dump;
- std::cerr << dump << std::endl;
- valMap[token] = dump;
- while(is >> dump && dump != ">")
- {
- valMap[token] += " " + dump;
- }
- }
- }
Additionally, the code in the loop is never executed, the checking for
(is >> token) seems to fail.
Calling clear() on is does not help.
Where "is" is std::ifstream and valMap std::map<std::string,std::string>.
valMap contains "name" form the data file in the first component.
Btw, I run a similar function right before, to collect all the names from the file, which runs just fine.