Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
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 online now   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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Carrier ipcc / plist file update / location help groovs Jailbreaks and iOS Hacks 7 Apr 14, 2011 03:49 PM
Reading and writing files and storage locations xcode portreathbeach iPhone/iPad Programming 1 Apr 2, 2011 06:22 PM
Help with c code for files coopf iPhone/iPad Programming 2 Nov 19, 2010 09:21 PM
XCode is not getting input from the file. C++ help needed. petercdcn Mac Programming 6 Apr 8, 2010 05:34 PM
Deleting Temporary Roxio Popcorn 2 Files - Location? Help! Donz0r Mac Applications and Mac App Store 1 Jan 13, 2007 12:53 PM


All times are GMT -5. The time now is 08:38 AM.

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

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