Re: NSString -> char* ?
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.