Re: Trouble using createFileAtPath method to create file
Re: Trouble using createFileAtPath method to create file
- Subject: Re: Trouble using createFileAtPath method to create file
- From: glenn andreas <email@hidden>
- Date: Fri, 12 Oct 2007 09:22:18 -0500
On Oct 12, 2007, at 9:10 AM, Jaime Rios wrote:
Hi,
I'm having trouble using the createFileAtPath method to create a
file in the
following directory:
/private/var/tmp/folders.501/Cleanup At Startup
The code that I am using to attempt creating the file is:
NSString* pFP = [(NSString*)sourcePath
stringByAppendingPathComponent:
[NSString stringWithCString:fileName
encoding:30]];
1) What is encoding 30? You should use one of the predefined
symbolic constants, not some value like 30.
2) How are you getting that sourcePath? If you've hardcoded it in,
you're just begging for trouble, even if it it does work (since that
won't work for other users). Your best bet is to use FSFindFolder,
use CFURLCreateFromFSRef to convert that fsref to a URL, and then get
the path from that.
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden