• 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: Can't set offset of a file NSOutputStream with appending enabled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't set offset of a file NSOutputStream with appending enabled


  • Subject: Re: Can't set offset of a file NSOutputStream with appending enabled
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 08 Jun 2013 09:41:53 -0500

On Jun 4, 2013, at 12:32 PM, Hank Bao wrote:

> I tried to set the offset property of a file NSOutputStream by NSStreamFileCurrentOffsetKey with appending enabled with code listed below.

Appending isn't "enabled", per se, it's a mode for the underlying file descriptor that forces data to always be appended to the end of the file.  See the open() system call and O_APPEND for the low-level equivalent.

What you're looking for is opening for writing without truncating.  It doesn't seem as though NSOutputStream supports that.  You may want to look into NSFileHandle instead.


> The document says that NSStreamFileCurrentOffsetKey allows me to manipulate the current read or write position in file-based streams.

That probably means that you can seek within a write stream for a file opened and truncated (after you've written some data, of course).

Regards,
Ken


_______________________________________________

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

  • Prev by Date: CALayer -displayLayer:inContext: never called during frame/bounds animation
  • Next by Date: Re: how to cache images
  • Previous by thread: Re: CALayer -displayLayer:inContext: never called during frame/bounds animation
  • Next by thread: Re: Can't set offset of a file NSOutputStream with appending enabled
  • Index(es):
    • Date
    • Thread