Re: cString deprecated!
Re: cString deprecated!
- Subject: Re: cString deprecated!
- From: Dustin Voss <email@hidden>
- Date: Wed, 4 Sep 2002 20:42:11 -0700
On Tuesday, September 3, 2002, at 06:32 PM, Rosyna wrote:
Err..
NSString* myString=[(NSString*)CFStringCreateWithCString(NULL,
cStringGoesHere, kCFEncodingMacRoman) autorelease];
I'd actually use the following code:
id string;
CFStringRef cfstring;
cfstring = CFStringCreateWithCString (NULL, theCString, encoding);
string = [self initWithString:(NSString*)cfstring];
CFRelease (cfstring);
return string; // or [string autorelease] if this is a stringWith...
method.
It probably doesn't make a difference, since NSString* and CFStringRef
are toll-free bridged...
but then again, so are addresses returned by malloc and new.
So, just to be on the safe side, I do it like this.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.