How do I access a .txt file in Xcode for an OSX command line tool?
I'm in school learning C and C++, and we have to read from and write to .txt files regularly. But I can't figure out how to open a .txt file in Xcode.
if FILE *buffer = fopen(filename,"r"); where filename is a pointer to a char array holding the name of the file, it works perfectly fine in the terminal. It compiles, in both Xcode and GCC, but when I try to actually open the file in Xcode, my program can never find it and quits the application (so it doesn't crash).
Long story short, what do I have to do to get my programs in Xcode to read from a .txt file?
I tried putting a copy of input.txt in every folder within the project, including it in the source files, adding it to target (which I don't wholly understand), I don't know what to do.
MacBook Pro, OS X Mavericks (10.9), Quad Core i7 15" 10GB RAM