|
-
May 21st, 2002, 06:57 AM
#1
char to hex
I have a char string called buf[2]. buf[0] and buf[1] are not characters, but hexadecimal numbers that I need to extract. Lets say, buf[0] = 0x02 and buf[1] = 0x70. How can I put these two numbers together (to form the hex number 0x0270) to form an int value?? Thanks.
-
May 21st, 2002, 07:29 AM
#2
Try
int lResult = (Buf[0] << 8) + Buf[1];
Regards
Alan
-
May 21st, 2002, 07:34 AM
#3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|