Is there any function that can convert text representation"ABCDEF" back to int ?
-
_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?
-
_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?
Try one of these functions[^], which allow you to specify the number base.
Unrequited desire is character building. OriginalGriff
-
_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?
I assume you are talking about converting character hexadecimal representation to an integer. Look at: http://www.dreamincode.net/code/snippet805.htm[^]
John Nawrocki Chief Technical Advisor Custom Molded Products