title: c++ Read from .csv file
body: <p>I have this code which is supposed to cout in console the information from the .csv file;</p>
  
  <pre><code>while(file.good())
  {
  
      getline(file, ID, ',');
      cout &lt;&lt; "ID: " &lt;&lt; ID &lt;&lt; " " ; 
  
      getline(file, nome, ',') ;
      cout &lt;&lt; "User: " &lt;&lt; nome &lt;&lt; " " ;
  
      getline(file, idade, ',') ;
      cout &lt;&lt; "Idade: " &lt;&lt; idade &lt;&lt; " "  ; 
  
      getline(file, genero, ' ') ; 
      cout &lt;&lt; "Sexo: " &lt;&lt;  genero&lt;&lt; " "  ;
  
  }
  </code></pre>
  
  <p>And a csv file that has this (when I open with notepad):</p>
  
  <pre><code>0,Filipe,19,M
  
  1,Maria,20,F
  
  2,Walter,60,M
  </code></pre>
  
  <p>Whenever I run the program the console will display this:</p>
  
  <p><img src="https://i.stack.imgur.com/jDbxY.png" alt="Unexpected output"></p>
  
  <p>My question is why isn't the program repeating those cout messages in every line instead of only in the first one </p>
  
  <p>Btw , nome is name, idade is age, and genero/sexo is gender, forgot to translate before creating this post</p>