title: fstream fails at inputting negative numbers
body: <p>so I was trying to do a little program, and when I try to input negative numbers from a .txt file, my program fails and just outputs random things after the first negative number.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  struct imones{
      string vardas;
      int koordx;
      int koordy;
  };
  
  void skaityti(int &amp;n, int &amp;m, imones A[]){
      ifstream ivest;
      ivest.open("U1.txt");
      ivest &gt;&gt; n &gt;&gt; m;
      for(int i=0; i&lt;n; i++){
          ivest &gt;&gt; A[i].vardas &gt;&gt; A[i].koordx &gt;&gt; A[i].koordy;
      }
      ivest.close();
  }
  
  
  int main()
  {
      imones A[50];
      int n, m;
      skaityti(n, m, A);
      cout &lt;&lt; A[0].vardas &lt;&lt; " " &lt;&lt; A[0].koordx &lt;&lt; " " &lt;&lt; A[0].koordy&lt;&lt;endl;
      cout &lt;&lt; A[1].vardas &lt;&lt; " " &lt;&lt; A[1].koordx &lt;&lt; " " &lt;&lt; A[1].koordy&lt;&lt;endl;
      cout &lt;&lt; A[2].vardas &lt;&lt; " " &lt;&lt; A[2].koordx &lt;&lt; " " &lt;&lt; A[2].koordy&lt;&lt;endl;
      cout &lt;&lt; A[3].vardas &lt;&lt; " " &lt;&lt; A[3].koordx &lt;&lt; " " &lt;&lt; A[3].koordy&lt;&lt;endl;
      cout &lt;&lt; A[4].vardas &lt;&lt; " " &lt;&lt; A[4].koordx &lt;&lt; " " &lt;&lt; A[4].koordy&lt;&lt;endl;
  }
  </code></pre>
  
  <p>U1.txt: </p>
  
  <pre><code>5 30
  Siuntuva    2 3
  Auda        3 –1
  Kostisa     –3 –2
  Linga       3 0
  Austuva     –2 –4
  </code></pre>
  
  <p>And when outputting, the -1 and everything after it becomes random numbers.</p>