As the Thread title Suggests I am having a problem taking 2 chars (which make up a byte) from the array and placing it into an Integer Variable all the while allowing it to retain its value. I have books here that Explain Type Conversion, but it does not go into Copius Detail on char to int conversion.
The 2 char values I am trying to take from the array will end up being a HEX Value within the Integer Variable.
I am trying to do 2 things:
1). Convert 2 chars from the array into an Integer HEX Value
2). Convert that New HEX Valued Integer to a Decimal Integer Value.
For the Sake of this thread, I will give an example:
RawPacket

= 3
RawPacket[9] = 9
Now this comes from the following Data within the array:
Code:
4840200039 |Array Data
----------
0123456789 |Corresponding Array Position
^^
||
\ ----------------------Position of 3 and 9
What I want to do is take that 3 and 9, put it together and put 39 into an int variable.
Then take that 39 and convert it into a decimal value which in this case would be 57.
Another Example:
Code:
484020005C |Array Data
----------
0123456789 |Corresponding Array Position
^^
||
\ ----------------------Position of 5 and C
What I want to do is take that 5 and C, put it together and put 5C into an int variable.
Then take that 5C and convert it into a decimal value which in this case would be 92.
I have had some algorithms given to me, but none of them worked.
Hopefully someone here can help me if possible.
Thank you