Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 3, 2008, 05:09 PM   #1
Concorde Rules
macrumors 68000
 
Join Date: Sep 2007
C++ Xcode file location help!

Basically this is for my aero eng course, so no changing coding language

Im trying to open a file from where Xcode stores the executable, IE in the debug folder.

Code:
	/* open file for input */
	inf=fopen("datafile.txt","r");
Reads it from my home folder (Where the docs folder etc is).

I would like it to read from the Debug folder in the project folder.

I've tried a few things but with no success.

Anyone help?

Cheers!
Concorde Rules is offline   0 Reply With Quote
Old Nov 3, 2008, 06:46 PM   #2
Berlepsch
macrumors 6502
 
Join Date: Oct 2007
Did you try something like
fopen ("/this/is/the/path/to/my/Debug/file.txt", "r")
yet?
__________________
"Everyone knows the inch is better than the centimeter, because it is bigger."
Berlepsch is offline   0 Reply With Quote
Old Nov 4, 2008, 07:02 AM   #3
toddburch
macrumors 6502a
 
Join Date: Dec 2006
Location: Katy, Texas
Send a message via AIM to toddburch Send a message via MSN to toddburch
When in doubt, print out your current working directory at runtime to see where it's set.
toddburch is offline   0 Reply With Quote
Old Nov 4, 2008, 07:21 AM   #4
Concorde Rules
Thread Starter
macrumors 68000
 
Join Date: Sep 2007
Edit: Ok, thats weird!!

Now it works with the full path where it didn't yesterday!!!

Oh well, all is good now.

Thanks people
Concorde Rules is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How to know the path of the file location from spotlight? hajime Mac Basics and Help 7 Nov 25, 2013 11:25 AM
Downloaded File Location - Anomaly? crjackson2134 OS X 10.8 Mountain Lion 5 Jun 10, 2013 07:49 PM
Aperture file location question lraymond Mac Applications and Mac App Store 2 Sep 10, 2012 09:36 PM
App to Find a File's Location in 10.7? macdaddy57 OS X 3 Sep 4, 2012 08:02 PM
Xcode installation location. MacMan988 Mac Programming 5 Jul 20, 2012 12:40 PM

Forum Jump

All times are GMT -5. The time now is 05:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC