I'm having trouble reading my text files using xCode. Here's part of my code:
I think I know why it's not working. After searching the forums, I've read xCode puts my text files in a different directory than my .c file. Thing is, I don't know where to put my text file so my program can read it. Can I move them in xCode somehow, or do I need to put them somewhere in the project folder?
Code:
//I initialized fileName as a char array earlier.
printf("What is the name of the file? ");
scanf("%s", fileName);
//Make LinkedList to make linked list of Players
fp = fopen(fileName, "r");
if(fp == NULL)
{
printf("Dang it!\n");
printf("I entered \"%s\"\n", fileName);
return 1;
}
I think I know why it's not working. After searching the forums, I've read xCode puts my text files in a different directory than my .c file. Thing is, I don't know where to put my text file so my program can read it. Can I move them in xCode somehow, or do I need to put them somewhere in the project folder?