randyg
asked on
Hex
I am using Visual C++ 5.0 and am in Dialog mode.
I am trying to convert numbers to Hex. I am using this statement and would like to know how to display the number in hex.
SetDlgItemInt(IDC_STATIC,m _number);
I would also like to know how to recieve a hex number from and EDIT box.
Thanks
Randy
I am trying to convert numbers to Hex. I am using this statement and would like to know how to display the number in hex.
SetDlgItemInt(IDC_STATIC,m
I would also like to know how to recieve a hex number from and EDIT box.
Thanks
Randy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I agree with Answers2000, itoa would be a good option, I have written a base x program, which converts any number to any base 2-36. input a number in anybase and output. If you want it you can have it, just E-mail me. g_dutoit@hotmail.com.
ASKER
Great answers!!!!!
Thanks
Thanks
To get the current text from an edit use GetDlgItemText, then use sscanf to get convert a hex number to a integer
char szOutput[256] ;
GetDlgItemText( IDC_EDIT, szOutput, sizeof szOutput ) ;
int nNumber ;
sscanf( szOutput, "%x", &nNumber ) ;
incidentally %x means use lower case letters in hex numbers, %X means use upper case
I think that's everything you need ?