Hi guys,
We have 3 files made that are inside a Profiles folder in our
resources folder, the names are profile1.pro, profile2.pro and
profile3.pro. These files now contain encoded data such as the players
score, and profile name, but we can't seem to save anything back to
these 3 files.
Is is possible to access a file inside the resources folder and write
to it? We can read from it, but writing is proving to be a problem.
We tried things such as this to get the full path which seemed to come
out right:
NSString * fullpath = [FileUtils fullPathFromRelativePath:@"Profiles/profile2.pro"];
NSString * fullpath = [[NSBundle mainBundle] pathForResource:@"profile2.pro" ofType:nil inDirectory:@"Profiles"];
But this doesn't write to the file:
["Hello world!" writeToFile:fullpath atomically:YES encoding:NSUTF8StringEncoding error:&error];
We also tried a C approach which also didn't give any results:
const char * path = [fullpath UTF8String];
pFile = fopen (path, "w");
fprintf(pFile, "Hello world!");
fclose(pFile);
If we work right off Macintosh HD or some other folder such as
Documents, it works fine, so I think the problem must be in the path
we're getting?
Any suggestions would be helpful, thanks!