How to read file, and get the last part of comma separated value, to be used for sum. e.g: I have this file name with this data
2014-12-22.16:31:36,3,3
2014-12-22.16:31:37,3,6
2014-12-22.16:31:38,3,9
2014-12-22.16:31:39,6,15
What I would like to get is actually the number 15 as an integer. so I can do addition with some other number. but any other way is also ok.. that number 15 is essentially, the sum of all 2nd part of comma separated value. I have the reading part
if(IsFileExist(theFileName)) {
std::ifstream file(theFileName);
std::string str;
while (std::getline(file, str)) {
}
}