title: different result from file reading and standard input with getline
body: <pre><code>bool validateCurrencyLine(string line){
      cout &lt;&lt; "TESTING LINE : " &lt;&lt; line &lt;&lt; endl;
      string pattern = "[ ]*([A-Z]{3}) ([0-9]+)([ ]*|,[0-9]+[ ]*)";
      boost::regex expr{pattern};
      return boost::regex_match(line,expr);
  }
  
  int main()
  {
      string line;
      while(getline(cin,line)){
          cout &lt;&lt; validateCurrencyLine(line) &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>The content of <code>test</code> file is as follows:</p>
  
  <blockquote>
    <p>IDK 3453443</p>
  </blockquote>
  
  <p>Now when I start a program using <code>./a.out &lt; test</code> the result is</p>
  
  <pre><code>TESTING LINE : IDK 3453443
  0
  TESTING LINE : 
  0
  </code></pre>
  
  <p>My assumption is that the second line is printed because the testfile first line is  actually</p>
  
  <blockquote>
    <p>IDK 3453443 + enter</p>
  </blockquote>
  
  <p>Am I correct?)</p>
  
  <p>But the real problem is that when I start it like this: <code>./a.out</code> and input "IDK 3453443" and press enter. The result of this is:</p>
  
  <pre><code>TESTING LINE : IDK 3453443
  1
  </code></pre>
  
  <p>Any thoughts why these two results differ?</p>