Re: Temporary files best practice?
Re: Temporary files best practice?
- Subject: Re: Temporary files best practice?
- From: Andrew Merenbach <email@hidden>
- Date: Sun, 2 Sep 2007 11:10:07 -0700
What about creating temporary folder subfolders, though? Looking at
the mkstemp man page, it doesn't sound as though mkstemp supports
making folders. If one wishes to write property-list-style data, the
file descriptor from mkstemp() would be inadequate unless on wishes
to convert to NSData, right?
Best wishes,
Andrew
On Sep 2, 2007, at 7:34 AM, Wincent Colaiuta wrote:
El 2/9/2007, a las 16:10, Andrew Merenbach escribió:
What about using -[NSProcessInfo globallyUniqueString] to name
your folder?
Cheers,
Andrew
Any method based on generating/getting a name and then testing for
existence and creating a folder or file with that name has a race
condition. See the mkstemp man page for a better solution:
The mkstemp() function makes the same replacement to the
template and
creates the template file, mode 0600, returning a file
descriptor opened
for reading and writing. This avoids the race between testing
for a
file's existence and opening it for use.
Cheers,
Wincent
_______________________________________________
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