title: Reading specific column from .csv in C++
body: <p>I have a .csv file that has around 5 rows and it looks something like this:</p>
  
  <pre><code>"University of Illinois, Chicago","1200, West Harrison","41.3233313","88.221376"
  </code></pre>
  
  <p>The first column is the name of the building, the second is the address and the third and fourth column represent the latitude and longitude. 
  I want to take only the values in the 3rd and 4th column for every row.</p>
  
  <p>If I use the getline method and separate every entry with <code>,</code> I do not get the desired result. Here is a sample of what I am doing:</p>
  
  <pre><code>ifstream file("Kiosk Coords.csv");
      double latt[num_of_lines];
      double longg[num_of_lines];
      string name;
      string address;
      string latitude;
      string longitude;
      flag = 0;
  
      while(file.good()){     
              getline(file,name,',');
              getline(file,address,',');
              getline(file,latitude,',');
              getline(file,longitude,'\n');
              //cout&lt;&lt;name&lt;&lt;" "&lt;&lt;address&lt;&lt;" "&lt;&lt;latitude&lt;&lt;" "&lt;&lt;longitude&lt;&lt;endl;
              cout&lt;&lt;longitude&lt;&lt;endl;
      }
  </code></pre>
  
  <p>For the above given input, I get the following values in the variable if I use my method:</p>
  
  <pre><code>name = "University of Illinois"
  address = "Chicago
  latitude = "1200"
  longitude = "West Harrison,41.3233313,88.221376"
  </code></pre>
  
  <p>What I specifically want is this:</p>
  
  <pre><code>latitude = "41.3233313"
  longitude = "88.221376"
  </code></pre>
  
  <p>Please help</p>