title: Command Line Arguments and File Input
body: <p>I had a terrible time with file input from command line arguments last semester and I need to utilize it for an exercise that I am working on. I have coded a simple shell just to get it working:</p>
  
  <p><strong>prob_5.c</strong></p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(int argc, char *argv[]) {
  int i;
  FILE *fp;
  int c;
  
  for (i = 1; i &lt; argc; i++) {
      fp = fopen(argv[i], "r");
  
      if (fp == NULL) {
          fprint(stderr, "cat: can't open %s\n", argv[i]);
          continue;
      }
  
      while ((c = getc(fp)) != EOF) {
          putchar(c);
      }
  
      fclose(fp);
  }
  
  return 0;
  }
  </code></pre>
  
  <p>I can't seem to remember what the commands are for invoking my program from the command line. I have tried:</p>
  
  <pre><code>gcc -o prob_5 -g -ansi prob_5.c
  </code></pre>
  
  <p>I have reformatted my computer since last semester, so perhaps I am missing a System Path?</p>