title: Passing fscanf to struct
body: <p>I'm trying to open a file and pass to <code>struct</code>, I'm using <code>fscanf()</code> with a loop, but it only saves one the <code>struct</code> the last read:</p>
  
  <p>Imagine a file:</p>
  
  <pre><code>JR John Rambo 24353432 
  JL John Lennon 6435463
  </code></pre>
  
  <p>I'm using this code:</p>
  
  <pre><code>typedef struct people{
      char code[10];
      char name[100];
      long telephone;
  }PEOPLE;
  
  int read(PEOPLE people[], int n_p){
      char temp;
      FILE *fp;
      fp=fopen("example.txt","r");
      if(fp==NULL){
          printf("Error\n");
          return -1;
      }
      while(!feof(fp)){
          fscanf(fp,"%s %s %s %d\n", people[n_p].code,people[n_p].name,
                 &amp;people[n_p].telephone);
      }
  }
  </code></pre>
  
  <p>The Problem is that he only saves the last line of the file...Should I do a if cicle??</p>
  
  <p>Another question is how can I separate a similar file but with ";"</p>