Mar 9, 2006 #1 selimsl Programmer Joined Aug 15, 2005 Messages 62 Location TR Code: char asciihex[5]; short int datax=10; sprintf(asciihex,"%4X",datax); As you know, result of this code is : " A" Is there any function to reverse this operation.I mean, Code: asciihex[5]=" A"; datax=function(asciihex); result is :datax=10 Thanks in advice...
Code: char asciihex[5]; short int datax=10; sprintf(asciihex,"%4X",datax); As you know, result of this code is : " A" Is there any function to reverse this operation.I mean, Code: asciihex[5]=" A"; datax=function(asciihex); result is :datax=10 Thanks in advice...
Mar 9, 2006 #2 Salem Programmer Joined Apr 29, 2003 Messages 2,455 Location GB Code: char asciihex[5]=" A"; short int datax; sscanf(asciihex,"%hX",&datax); -- Upvote 0 Downvote
Mar 10, 2006 #3 ArkM IS-IT--Management Joined Oct 21, 2002 Messages 1,819 Location RU Or use strtol() from stdlib.h: Code: datax = strtol(asciihex,0,16); Upvote 0 Downvote