Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

vivi0

macrumors newbie
Original poster
Nov 7, 2003
1
0
nowhere, im a nomad
I am a newbie to XCode and Cocoa in general. I am not a newbie to C, however. I am an experienced C programmer, and my reason for using XCode is to provide graphical frontends to my currently text-only C programs. I have been having trouble with Cocoa though. I understand how to create a new Controller, and then create Outlets and Actions for it, and then instantiate it and then link that to all the things I wanted.

What I don't know how to do is get the text from edit boxes into variables that I can then use as if they were created from scanf. I just want the text from my edit boxes to get transfered to strings that I can then use my C knowledge to work with. Also, I would like to know how I could convert the strings into other types of data types like integers or whatever. And I would like to know how I can then transfer those values back to the edit box when I am done with it.

Thanks infinitely in advance,
 

bousozoku

Moderator emeritus
Jun 25, 2002
15,882
2,093
Lard
The following is an example where I've gotten the text out of one field, sent it to a conversion routine, and made it the text in another field.

/* get the text from the field, pass to conversion routine, put the text in the ban mask text field */

[banMask setStringValue: [converter convertMask: [hostMask stringValue]]];

Of course, setStringValue requires a NSString. If you have a C string, you can create a new temporary NSString within the message (method call, if you prefer) and initWithCString to get the text in there.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.