Results 1 to 2 of 2
i want to have a user to enter numerical values in a text field, then I take these values and send them to various functions. But heres the trick, the ...
- 04-26-2007 #1Just Joined!
- Join Date
- Dec 2003
- Posts
- 41
Gtk programming help
i want to have a user to enter numerical values in a text field, then I take these values and send them to various functions. But heres the trick, the user is only going to be entering hexadecimal values.
One way that may work is to use gtk_entry_new () to get the text field up and running. But it seems as if it will only return string types. How do I covert this to hex? Or mayb there another way of accomplishing this?
--thanks.
- 04-29-2007 #2
Alrighty. So you have the string returned by the entry. You now need to use glibc's strtol function. The basic form will be:
Read the man page for strtol: it's pretty cool.Code:int number = (int) strtol(your_number, NULL, 16);
Hope that helps!DISTRO=Arch
Registered Linux User #388732


Reply With Quote