title: Getting a core segmentation fault when trying to read a file from argv[]
body: <p>I have been getting a core segmentation fault when trying to read a file from argv[]. I have created the file and I am very sure that I am trying to access the correct memory address. However, when trying to open the file I receive the core dump. </p>
  
  <p>Here is the relavent code- </p>
  
  <pre><code>  for (int x=1;x&lt;argc;x++){
    int buffsize=2056;
    char buff[buffsize];
    FILE* thefile;
    thefile=fopen("argv[x]","r");
    if (thefile == NULL) {
      fprintf(stderr, "%s cannot open file '%s'\n", argv[0], argv[1]);
      return 2;
    }
  </code></pre>
  
  <p>The command line argument I am passing in is</p>
  
  <p><code>./words testfile.txt</code></p>
  
  <p>with ./words being the compiled code. </p>
  
  <p>I actually found the solution, it seems to be the quotes in argv in the fopen, why is this?</p>