title: std::getline stuck on end of piped input
body: <p>I am failing to parse this file:</p>
  
  <pre><code>1
  
  3
  John Doe
  Jane Smith
  Jane Austen
  1 2 3
  2 1 3
  2 3 1
  1 2 3
  3 1 2
  </code></pre>
  
  <p>With the following program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;sstream&gt;
  
  int main( int argc, char * argv[] )
  {
  
      int cases, candidates_number;
      char candidates[20][80];
      int votes[20][1000];
      int votes_count[20];
  
      std::string line;
  
      std::cin &gt;&gt; cases;
      std::cin.get();
      std::cin.get();
  
      for (int i=0; i&lt;cases; i++) {
  
          std::cin &gt;&gt; candidates_number;
          std::cin.get();
  
          for (int j=0; j&lt;candidates_number; j++) {
              std::cin.getline(candidates[j], sizeof(candidates[j]), '\n');
          }
  
          int votes_number = 0;
  
          while (std::getline(std::cin, line)) {
              if (line.empty()) {
                  break;
              }
              std::cout &lt;&lt; line;
              votes_number++;
          }
  
      }
      return 0;
  }
  </code></pre>
  
  <p>In particular, the process gets stuck in the while loop after reading the last line of the file. I am invoking my program through the "Standard input" feature in Eclipse.</p>
  
  <p>Why isn't <code>std::getline</code> failing and causing the program to finish?</p>
  
  <hr>
  
  <p>Problem requirements:</p>
  
  <blockquote>
    <p>Australian ballots require that voters rank all the candidates in
    order of choice. Initially only the first choices are counted, and if
    one candidate receives more than 50% of the vote then that candidate
    is elected. However, if no candidate receives more than 50%, all
    candidates tied for the lowest number of votes are eliminated. Ballots
    ranking these candidates first are recounted in favor of their
    highest-ranked non-eliminated candidate. This process of eliminating
    the weakest candidates and counting their ballots in favor of the
    preferred non-eliminated candidate continues until one candidate
    receives more than 50% of the vote, or until all remaining candidates
    are tied.</p>
    
    <p><strong>Input</strong></p>
    
    <p>The input begins with a single positive integer on a line by itself
    indicating the number of cases following, each as described below.
    This line is followed by a blank line. There is also a blank line
    between two consecutive inputs.</p>
    
    <p>The first line of each case is an integer n$ \le$20 indicating the
    number of candidates. The next n lines consist of the names of the
    candidates in order, each up to 80 characters in length and containing
    any printable characters. Up to 1,000 lines follow, each containing
    the contents of a ballot. Each ballot contains the numbers from 1 to n
    in some order. The first number indicates the candidate of first
    choice; the second number indicates candidate of second choice, and so
    on.</p>
    
    <p><strong>Output</strong></p>
    
    <p>The output of each test case consists of either a single line
    containing the name of the winner or several lines containing the
    names of all candidates who are tied. The output of each two
    consecutive cases are separated by a blank line.</p>
  </blockquote>