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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to