Jump to content
  • Advertisement
Sign in to follow this  
Aphyxia

XCode(IPhone) fileIO

This topic is 3407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

** EDIT ** I realized this was probably a compiler specific problem and moved this to general programming, sorry for any inconvenience. ** EDIT ** I am trying to figure out how to open a fstream with a relative filepath. 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. [Edited by - Aphyxia on January 24, 2009 6:18:46 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!