title: How to assign values to a variable when reading in a CSV file?
body: <pre><code>struct LLGM{
    float Lat;
    float Long;
  };
  
  int main ()
  {
   string Filename;
   int count = 0;
   string value;
   string temp;
   ifstream infile2;
   Filename = "LLMGReadingsv2.csv";
   infile2.open(Filename); 
  
   if(infile2.fail())
   {
      cout &lt;&lt; "Error opening file" &lt;&lt; endl;
      exit(1);
   }
  
   while(!infile2.eof())
   {
      getline(infile2, temp, ',');
      count++;
   }
  
   cout &lt;&lt; count &lt;&lt; endl;
  
   cout &lt;&lt; endl;
  
   infile2.close();
  
   ifstream infile;
  
   infile.open(Filename);
  
   LLGM *points;
   points = new LLGM [count];
  
   for (int i = 0; i &lt; count; i++)
   {
      infile &gt;&gt; points[i].Lat;
      infile &gt;&gt; points[i].Long; 
  
      cout &lt;&lt; points[i].Lat;
      cout &lt;&lt; points[i].Long;
   }
  
   cout &lt;&lt; endl;
  
   return 0;
  }
  </code></pre>
  
  <p>My question is, how can I assign the values being read in from the CSV file to individual variables?</p>
  
  <p>For Example:</p>
  
  <p>35.123445,-85.888762 (values in one row from the file)
  I would like the first number before the comma to be Latitude, and the second value to be Longitude.</p>
  
  <p>Any help would be greatly appreciated!</p>