• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Temporary files best practice?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Temporary files best practice?
      • From: "Finlay Dobbie" <email@hidden>
    • Re: Temporary files best practice?
      • From: Dave Dribin <email@hidden>
References: 
 >Temporary files best practice? (From: Knut Lorenzen <email@hidden>)
 >Re: Temporary files best practice? (From: Andrew Merenbach <email@hidden>)
 >Re: Temporary files best practice? (From: Wincent Colaiuta <email@hidden>)

  • Prev by Date: Re: initializing ivars
  • Next by Date: Re: Temporary files best practice?
  • Previous by thread: Re: Temporary files best practice?
  • Next by thread: Re: Temporary files best practice?
  • Index(es):
    • Date
    • Thread