title: How do I scan a file in C using fscanf
body: <p>I am using the code </p>
  
  <pre><code>while(fscanf(input, "%49[^@ ]@%49s -&gt; %49[^@ ]@%49s", sender, trash, receiver, trash) != EOF){
     printf("%s " "%s\n", sender, reciever);
  }
  </code></pre>
  
  <p>to try to read and print every line from a file
  however when I run this code it gets stuck in an endless loop printing the first line of the file over and over again. How can I move the scanner down to the next line after it has executed this code. Thank you in advance for any help.</p>