• 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: NSString -> char* ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString -> char* ?


  • Subject: Re: NSString -> char* ?
  • From: Chris Ridd <email@hidden>
  • Date: Mon, 25 Aug 2003 17:55:24 +0100

On 25/8/03 5:26 pm, Pei Xiang <email@hidden> wrote:

> hi, i'm a newbie in Object-C.
>
> i'm using a library written in standard C. one
> function of the lib accepts "char *" string as
> parameter. but in Object-C, string manipulations are
> handled by NSString class. so, to use this libray, i
> think i have to find a way to convert from NSString
> into "char *". i checked online docs about NSString,
> but only find it possible to do the other way around
> (char* -> NSString).
>
> has anybody experience in converting NSString to
> char*? or is there any better way to solve my problem?
> thanks a lot!

Try NSString's -dataUsingEncoding:, or
-dataUsingEncoding:allowLossyConversion:.

The NSString -cString method is deprecated in favour of those two methods.

Cheers,

Chris
_______________________________________________
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.

References: 
 >NSString -> char* ? (From: Pei Xiang <email@hidden>)

  • Prev by Date: NSString -> char* ?
  • Next by Date: Re: NSString -> char* ?
  • Previous by thread: NSString -> char* ?
  • Next by thread: Re: NSString -> char* ?
  • Index(es):
    • Date
    • Thread