المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Is there any function that can convert text representation"ABCDEF" back to int ?



C++ Programming
08-10-2011, 02:30 PM
_itoa can convert int value such as 15 to F, but the atoi function cannot convert it back. it simply treat any letter that is not numerical( '0' - '9' ) as wrong input value.
I have an edit control to display something hexadecimal, say a pointer, a handle,so I do the follow,
_itoa( i, szBuffer, 16 ) ;
SetDlgItemText( hDlg,szBuffer ) ;
when I want the value back, I need to convert it back to int representation. But I am stuck here.
Does someone know any function that fix my problem?