Opening a text file in a bundle with C…
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi folks! I'm working with bundles for the first time, and I'd like to know how to open a text file inside one with C++. What I have now is this:
ifstream file = new ifstream(fileName.c_str());
if (!file->is_open())
return false;
Where fileName is a std::string. This is the way I'm accustomed to opening files (I'm from a Windows development background -- don't hate me! 🙂 ). Unfortunately, the is_open() test always fails.
I know how to get the path of the bundle. Once I add on my data subdirectory and file name, the fileName variable ends up as this:
/Users/sb/...project location.../Debug/MyProg.app/data/Dev Options.ini
Should the path be different somehow? Thanks for any help!
1 reply
Sign in or join Beachball Help to reply.
- 0