Angus Leeming <[EMAIL PROTECTED]> writes: | Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: | > "Bo Peng" <[EMAIL PROTECTED]> writes: | > | +void FilePositions::readFile(string const & filename) | > | +{ | > | + // we will not complain if we can't find filename nor will | > | + // we issue a warning. (Lgb) | > | + ifstream ifs(filename.c_str()); | > | + string tmp; | > | + | > | + while (getline(ifs, tmp) && file_positions.size() < num_positions ) { | > | + // pos, filename\n | > | + FilePos pos; | > | + string fname; | > | + istringstream itmp(tmp); | > | + itmp >> pos; | > | + itmp.ignore(2); // ingore "," | | > Typo in comment. Also are you not ignoring ", "? | | If this is meant to be code to read a comma-separated list, then it's not | robust. This file can be edited by hand...
If you edit it by hand you are on your own. But sure if we can make it more robust. | Bo, have a look at Boost.Tokenizer. It's ideally suited to, well, | tokenizing ;-) Perhaps boost::regex will be even easier. -- Lgb