Re: What is the life of the c string returned by NSString's UTF8String method?
Re: What is the life of the c string returned by NSString's UTF8String method?
- Subject: Re: What is the life of the c string returned by NSString's UTF8String method?
- From: Wade Tregaskis <email@hidden>
- Date: Fri, 18 Sep 2009 13:53:38 -0700
Or to avoid a copy and raw memory management, you can also query
directly an NSData from the string using -[NSString
dataUsingEncoding:NSUTF8StringEncoding] and then use -[NSData bytes]
as the returned value for this method is guarantee to have the same
life as the NSData object.
Though of course you must then beware the GC.
Wade
_______________________________________________
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