title: C++ how to read a file and parse the comma separated value
body: <p>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</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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</p>
  
  <pre><code>if(IsFileExist(theFileName)) {
      std::ifstream file(theFileName);
      std::string str; 
  
      while (std::getline(file, str)) {
  
      }
  }
  </code></pre>