Re: Simple CFString ref question (take pity on ObjC dude)
Re: Simple CFString ref question (take pity on ObjC dude)
- Subject: Re: Simple CFString ref question (take pity on ObjC dude)
- From: Guy English <email@hidden>
- Date: Sat, 18 Mar 2006 19:05:11 -0500
On 18-Mar-06, at 6:33 PM, Steve Cronin wrote:
theParameters.p1 = CFSTR("String1");
theParameters.p2 = CFSTR("TString2");
What I want to do is change it to something close to:
theParameters.p3 = [[NSString stringWithFormat:@"%@",newVal]
cStringUsingEncoding:[NSString defaultCStringEncoding]];
theParameters.p3 = (CFStringRef)[NSString stringWithFormat: @"%@",
newVal];
NSString objects and CFStringRefs are essentially the same thing so
you can use them interchangeably.
Note though that in the code snippet you show the first two params
will be around for the life of the app (since they're statically
allocated) but the return value of [NSString stringWithFormat: ...]
is autoreleased. This will only matter if you're planning on keeping
theParameters around from longer than the current pass through the
runloop.
Take care,
Guy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden