title: Reading a C file, read an extra line, why?
body: <p>I don't know exactly why a file pointer reads an extra line from a file, specifically the last line, here is the code:</p>
  
  <pre><code>FILE *fp ;
  fp = fopen ("mac_ip.txt", "r") ;
  int mac;
  char *ip = (char *) malloc(15);
  
  while(!feof(fp)){
      fscanf(fp,"%i",&amp;mac);
      fscanf(fp,"%s",ip);
  
      printf("MAC: %i\n",mac);
      printf("IP: %s\n",ip);  
  }
  </code></pre>
  
  <p>and the file has exactly 20 lines, but the line 20, is printed twice.</p>
  
  <p>Which is the error?</p>
  
  <p>Thanks in advance.</p>