title: building a very simple parser in C
body: <p>I'm trying to build a very simple parser in C for a class. All it has to do is read in a flag from an input file, determine if the flag precedes an int, char, or float and then write int/float/char to the appropriate .txt file. for example I 9898 would be printed to int.txt. Whenever use the testing script the instructor provided i get these errors:</p>
  
  <p><code>parser.c:1:1: error: unknown type name ‘e’
  parser.c:1:10: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘on’
  parser.c:1:10: error: unknown type name ‘on’</code></p>
  
  <p>This is my code please let me know. Thanks so much:</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
  #include &lt;stdio.h&gt;
      FILE *input = fopen("input.txt", "r");
      FILE *ints.txt = fopen("ints.txt" "w");
      FILE *chars.txt = fopen("chars.txt", "w");
      FILE *floats.txt = fopen("floats.txt", "w");
  
      char flag;
      int ipint;
      char ipchar;
      float ipfloat;
      int exitStatus = fscanf(input.txt, "%c", &amp;flag);
  
      while (exitStatus != EOF)
      {
          if (flag == I)
          {
              fscanf(input.txt, "%i", &amp;ipint);
              fprintf(ints.txt, ipint);
          }
          if (flag == C)
          {
              fscanf(input.txt, "%c", &amp;ipchar);
              fprintf(chars.txt, ipchar);
          }
          if (flag == F)
          {
              fscanf(input.txt, "%f", &amp;ipfloat);
              fprintf(floats.txt, ipfloat);
          }
      }
      fclose(input.txt);
      fclose(ints.txt);
      fclose(floats.txt);
      fclose(chars.txt);
  }
  </code></pre>