title: Reading from input file
body: <p>I'm having trouble reading from an input file.
  The input file looks like this</p>
  
  <p>Lionel Messi -10 43</p>
  
  <p>Fernando Torres 9 -29</p>
  
  <p>Cristiano Ronaldo 7 31</p>
  
  <p>Wayne Rooney 10 37</p>
  
  <p>Neymar 17 29</p>
  
  <p>Andres Iniesta 8 32</p>
  
  <p>Robin van Persie 19 20</p>
  
  <p>Lionel Messi 10 43</p>
  
  <p>Xavi Hernandez 6 36</p>
  
  <p>Mesut Özil 10 38</p>
  
  <p>Didier Drogba 10 35</p>
  
  <p>Fernando Torres 9 29</p>
  
  <p>Kaká 10 17</p>
  
  <p>The problem is that I cant use the getline function because I want to store the name into a single variable to store into an array, and the first number into a variable and the second into another variable. I also tried to use the peek function but I have never learned that so I had no success with it.
  If anyone knows how to read until the end of the name and store it into a single variable that would be much appreciated.</p>
  
  <p>This is what my code looks like when im reading from the input file</p>
  
  <pre><code>while(!fin.eof())
      {
  
       fin &gt;&gt; first &gt;&gt; last &gt;&gt; num &gt;&gt; point;
  
       if (num &gt; 0 &amp;&amp; point &gt; 0)
       {
               list[i].firstname = first;
               list[i].lastname = last;
               list[i].number = num;
               list[i].points = point;
               i++;
       }
       else if (num &lt; 0 || point &lt; 0)
       {
               reject[j].firstname = first;
               reject[j].lastname = last;
               reject[j].number = num;
               reject[j].points = point;
               j++;
       }
  
      }
  </code></pre>
  
  <p>This works perfectly if the input has a first and a last name. I know the problem is
  on the
      fin >> first >> last >> num >> point;</p>
  
  <p>but i am not exactly sure how to put first and last (and possibly middle) together</p>