Re: Getting started in Cocoa and IB
Re: Getting started in Cocoa and IB
- Subject: Re: Getting started in Cocoa and IB
- From: Chris Ridd <email@hidden>
- Date: Tue, 03 Dec 2002 16:24:41 +0000
On 3/12/02 4:03 pm, Julien Silland <email@hidden> wrote:
>
Le mardi, 3 dic 2002, ` 16:49 Europe/Paris, John Clark a icrit :
>
>
>
>
> However, my very simplistic first try seems to be very frustrating.
>
> What I need is
>
> a hint on how to have a NSTextField result in an action which takes
>
> the string
>
> typed by the user, and placed in a regular 'char' variable for use in
>
> a set of
>
> standard C functions.
>
>
>
You can try the cString function of the NSString object. It returns a
>
const char * type.
>
>
myString = [myTextField stringValue];
>
myConstChar = [myString cString];
For a cheap and cheerful test program that's fine. However the cString
method is deprecated so you shouldn't really use it... Presumably because
there's no control over what encoding is used in the string.
Consider using NSString -dataUsingEncoding: method instead (you end up with
an NSData, but that's no problem really), or even NSString's -UTF8String
method.
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.