Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nickatron

macrumors newbie
Original poster
Mar 21, 2011
2
0
Hello,

I am in an introductory c++ programming class, and my program uses infile to read a .txt file and uses cout to display the contents. The program works great, but I had to put my text file in users/home/library/developer/xcode/deriveddata/PPC_5-aksdjhgad/build/products/debug/

That is a mouthful! Is there an easier way to include my textfile, or build my program in the same directory as my .cpp file?
 
I haven't downloaded XCode 4, but others have mentioned where to change the working directory in the settings. you may want to search the forums for XCode working directory or something like that.

Alternately, you could just use g++ at the terminal and not have to worry about any of this IDE hootenanny that is more likely to get in your way than help you at this stage of the game. Learn how to program, don't learn how to program in XCode.

-Lee
 
I haven't downloaded XCode 4, but others have mentioned where to change the working directory in the settings. you may want to search the forums for XCode working directory or something like that.

Alternately, you could just use g++ at the terminal and not have to worry about any of this IDE hootenanny that is more likely to get in your way than help you at this stage of the game. Learn how to program, don't learn how to program in XCode.

Links for both topics:

https://forums.macrumors.com/threads/1119349/

https://forums.macrumors.com/threads/1090449/

B
 
Thanks, I found my answer in one of the above links. Xcode > Preferences > Locations > Build Location
 
At the very least you need quotes around the filename?

Doh!

As I understand it you don't need a flag with ifstream - its already in there by default. You do if you use the more general fstream though.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.