title: My C program reads a text file. When I put it into Xcode it fails. What's happening?
body: <p>I have a function that opens a .txt, uses fscanf to read numbers formatted like:</p>
  
  <pre><code>532
  2
  -234
  32
  </code></pre>
  
  <p>etc. It successfully does this when I compile using GCC, but I can't get the file to open in Xcode, why? 
  The relevant code is:</p>
  
  <pre><code>int main (void){
      FILE *infile = NULL;  //input file buffer
      int int_array[100];   //an integer array 100 entries long
      char infilename[256];  //an extra large char array 
          //this entire while loop was provided as part of the assignment, 
          //we weren't supposed to change it. I've finished this assignment, 
          //but now I want to know how to use my Xcode debugger
      while(infile == NULL) {
          printf("Input filename:");     //user prompt
          scanf("%s",infilename);        //store user input in large char array
          if((infile = fopen(infilename, "r")) == NULL) {      //input file buffer opens file
              printf("ERROR: file %s can not be opened!\n",in filename); //error if can not open
          }
      }
      int arraySize =0;
  
      while (!feof(readfile)) {           //StackOverflow showed me how to use this function.
          fscanf(readfile, "%d", (array+arraySize));
          arraySize++;
      }
      //more code...
  }
  </code></pre>
  
  <p>In my Xcode project I have hw1.c, hw1_functions.c, input.txt, and some uncalled c functions all in the same folder. When I run the program, it prompts me to enter the name of the file. I say input.txt just like I do in the terminal after using GCC, but I get "ERROR file input.txt can not be opened!" 
  Is there something I need to do to make this work?</p>