Text File in Program Directory

Hey Everyone !

I'm trying to place a text file into my program's project directory.

I followed the instructions below.

But, my code doesn't appear to be linking with the file. My output is in the bottom right of the photo below.

Help ! Please and thank you. ;o)

Answered by Graphics and Games Engineer in 694787022

Hi there,

I think the answer on this https://stackoverflow.com/questions/9295043/xcode-4-c-project-add-file-to-build-directory might help you. Alternatively, you can pass the path of your file as a command line argument to your program. The issue here is that your program is looking for the text file in the same directory that the application is in, and it’s not there.

Accepted Answer

Hi there,

I think the answer on this https://stackoverflow.com/questions/9295043/xcode-4-c-project-add-file-to-build-directory might help you. Alternatively, you can pass the path of your file as a command line argument to your program. The issue here is that your program is looking for the text file in the same directory that the application is in, and it’s not there.

That appears to have worked ! You're a legend !

Text File in Program Directory
 
 
Q