title: Reading from text file to structure
body: <p>Firstly, I'd like to explain what I'm trying to do. So, I have a text file with 10 names followed by their points. I'm trying to create a structure and read information from a file using a function (void). And that's my code and text file:</p>
  
  <p>code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void read(struct laLiga t[]) {
      ifstream infile("info.txt");
      int i = 0;
      while(infile &gt;&gt; t.team[i] &gt;&gt; t.points[i]) {
          infile.get(t.team);
          infile &gt;&gt; t.points;
          i++;
      }
  }
  
  struct laLiga {
      char team[50];
      int points;
  };
  
  int main() {
      struct laLiga t[10];
      read(t);
      return 0;
  }
  </code></pre>
  
  <p>text file:</p>
  
  <pre><code>Athletic Bilbao  15
  Atletico Madrid  18
  Barcelona  16
  Alaves  10
  Las Palmas  12
  Real Madrid  18
  Real Sociedad  10
  Sevilla  17
  Eibar  11
  Villarreal  16
  </code></pre>