title: Reading a .asm file in a compiler via a read function
body: <p>I'm trying to write a program that will be able to read an .asm file, in c. </p>
  
  <pre><code>#include  &lt;stdio.h&gt;
  
  int preprocess_get_line(char label[], char instruction[], FILE* fp);
  
  int main(int argc, char *argv[])
  {
      /* Open file and check success */
      char *filename = "helloworld.asm";
      if (argc &gt;1)
      {
          filename = argv[1];
      }
      FILE* inputfile = fopen(filename, "r");
      if(inputfile == NULL)
      {
          fprintf(stderr, "Unable to open \"%s\"\n", filename);
          return 1;
      }
      while (preprocess_get_line(label, instruction, inputfile))
      {
          fprintf("%s: %s", label, instruction);
      }
      return 0;
  }
  
  int preprocess_get_line(char label[], char instruction[], FILE* fp)
  {
      fgets(str,260, fp);
      while(character != EOF)
      {
          printf("ASCII hex: %2x '%c'\n", (int)character, character);
          character = fgets(inputfile);
      }
      fclose(inputfile); 
  } 
  </code></pre>
  
  <p>This is my code that I've written however I keep on receiving multiple errors in my code.
  A specific error that I have in line 19
  <strong>label undeclared(first use in this function)</strong>
  my understanding is that I've already declared the function(on line 2.)
  Another error in line 19
  <strong>each undeclared identifier is reported only once for each function it appears in</strong>
  As for this error i'm not particularly sure as to what the problem is.</p>