Original Post
I am trying to figure out how to open a fstream with a relative filepath for an iphone game i'm making, I know there is a phones section but i'm pretty sure this problem is compiler specific not iphone specific. for example in visual studio it goes from the project file so if i wanted to open a file "openme.txt" in the path that follows c:/(...)/solution folder/the Project Folder/subfolder1/subfolder2/openme.txt i would do ifstream fin("subfolder1/subfolder2/openme.txt"); The only way i can figure out in xcode is give it the absolute path(eww). or NSString* path = [[NSBundle mainBundle] pathForResource: @"openme" ofType: @"txt"]; ifstream fin([path cStringUsingEncoding:1]); I have 3 major problems with that method. 1. that fills path out with a fullpath name still, not a relative one (not a big deal yet but seems ugly) 2. for that function to work it requires the file to be included in the project, so i can't just make a new image and script file with that file name in it to create a new level, I have to actually rebuild the project with a new image... makes 'expansion packs' difficult. 3. I realize its not what apple "prefers" but i'm trying to keep the 'objective-C' out of the actual game code and just in the wrappers so that the game itself is as portable as can be. Anyway, i suppose this could have been shorter but i wanted to explain why I'd prefer not to use that approch. Thanks.