title: While does it go through the while loop twice
body: <p>I have trying parse a text file called FileName that looks like:</p>
  
  <pre><code>KD JD 6s 5s 3c // no rank (king high)
  AH Ks Js AD Ac // three of a kind
  </code></pre>
  
  <p>Now I wanna store them into a vector (everything before "//"). </p>
  
  <pre><code>int FileParsing(vector&lt;Card&gt; &amp; v, char * FileName) {
      ifstream ifs;
      ifs.open(FileName);
      if (!ifs.is_open()){
          cout &lt;&lt; "file cannot be opened." &lt;&lt; endl;
      } else {        
          string line;                    
          while(getline(ifs, line)){
              istringstream iss (line); 
              bool condition = CountWords(line); //dont worry about this method   
              ReadCardDefinitionStrings (condition, line, v);
          }       
      }
      return 0;
  }
  
  
  void ReadCardDefinitionStrings (bool condition, string line, vector&lt;Card&gt; &amp; v){
      istringstream iss (line);   
      string CardDefinitionStrings;   //e.g. 2C, 3h, 7s, Kh
      if (condition) {
              while(iss&gt;&gt;CardDefinitionStrings){  
              if (CardDefinitionStrings == "//"){ //stop reading after it sees "//"
                  return;
              }
              Card c = TestCard(CardDefinitionStrings);
              v.push_back(c);     
          }
      }
  }
  </code></pre>
  
  <p>The problem I am getting is: when it sees "//" after 3c, it goes back to </p>
  
  <pre><code>    while(getline(ifs, line)){
          istringstream iss (line); 
          bool condition = CountWords(line);  
          ReadCardDefinitionStrings (condition, line, v);
      }
  </code></pre>
  
  <p>But this time, line is empty (I wanted it to be: AH Ks Js AD Ac // three of a kind), which means this loop runs one time without doing anything. And the next run, line would be equal to AH Ks Js AD Ac // three of a kind. Any idea why this happens? </p>