title: Getline skips the first line in my while loop?? (C++)
body: <p>Fairly simply question. Below is my code and I'm trying to read the first word for each line on a text file. I am pretty much new to C++ and basically illiterate, so a vivid explanation would be really helpful. Thanks in advance!</p>
  
  <p>The output I want is:</p>
  
  <p><em>Warrior (5 times), Status, Battle (5 times), Status</em> (separate lines of course)</p>
  
  <p>But what I get is:</p>
  
  <p><em>Warrior (4 times), Status, Battle (5 times), Status</em></p>
  
  <p>Here is my code:</p>
  
  <pre><code>int main() {
      string readText;
      string command;
      string firstName;
      string skip;
      int strength;
      ifstream inFile("warriors.txt");
      if (!inFile) {
          cout &lt;&lt; "File will not open" &lt;&lt; endl;
      }
      else {
          while (inFile &gt;&gt; readText) {
              getline(inFile, command);
              inFile &gt;&gt; command;
              if (command == "Warrior") {
                  cout &lt;&lt; "warrior" &lt;&lt; endl;
              }
              else if (command == "Battle") {
                  cout &lt;&lt; "battle" &lt;&lt; endl;
              }
              else if (command == "Status") {
                  cout &lt;&lt; "status" &lt;&lt; endl;
              }
          }
      }
  }
  </code></pre>
  
  <p>Another question on the side, why is it that when I change:</p>
  
  <pre><code>    while(inFile &gt;&gt; readText)
  </code></pre>
  
  <p>to </p>
  
  <pre><code>    while(inFile)
  </code></pre>
  
  <p>My output is now: 
  <em>Warrior (4 times), Status, Battle(5 times), Status, Status</em></p>