title: How to read until end of file C, fscanf
body: <p>What i read from a file: a P1/ s/ e/ t etc. / for different line. After specific letters(like 'a') come some data i have to collect so i don't want to use fgets. It doesn't end running. Could you help me, please? </p>
  
  <pre><code>char com[21];
  fscanf(src,"%s",com);
  while(com!=EOF)
  {
      if(com[0]=='a')
          fprintf(dest,"%s 1",com);
       if(com[0]=='s')
          fprintf(dest,"%s 2",com);
      fscanf(src,"%s",com);
  }
  </code></pre>