• 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: cString deprecated!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: cString deprecated!
      • From: Rosyna <email@hidden>
References: 
 >Re: cString deprecated! (From: Rosyna <email@hidden>)

  • Prev by Date: Re: Launching an App without NSWorkspace?
  • Next by Date: Re: [ANN] More Internet Preference Pane
  • Previous by thread: Re: cString deprecated!
  • Next by thread: Re: cString deprecated!
  • Index(es):
    • Date
    • Thread