title: fscanf copies a line from file twice in C
body: <pre><code>                while(1&lt;2) {
                      nscan=fscanf(infile, "%s %s %d%c",temp.name, temp.surname,&amp;temp.code,&amp;termch);
                      if(nscan==EOF) break;
                      if(nscan!=4 || termch!='\n')
                          printf("Error\n");
                      RecBSTInsert(&amp;a,temp);
  
               }
  </code></pre>
  
  <p>for some reason nscan //if(nscan==EOF) break; does not get executed when it is supposed to and it runs one more time giving the binary tree one more value, which is same with the last one.</p>