converting Hex to int
-
Hi, How to convert an array of Hex values to int in Visual C, is there any function for converting? chaitu
-
Hi, How to convert an array of Hex values to int in Visual C, is there any function for converting? chaitu
-
Hi, How to convert an array of Hex values to int in Visual C, is there any function for converting? chaitu
this doesn't mean anything to convert from hexadecimal to int... hexadecimal IS an integer, but it only differs from the graphical representation... if you have 32 apples, it is the same as having 0x20 apples... what you certainly mean however is reading hexadecimal characters from a string (but that is important to know if it is a string or not) into ints... if so,
sscanf()
is done your you. otherwise, give more details about what you really have, and what you really want... cheers, -
this doesn't mean anything to convert from hexadecimal to int... hexadecimal IS an integer, but it only differs from the graphical representation... if you have 32 apples, it is the same as having 0x20 apples... what you certainly mean however is reading hexadecimal characters from a string (but that is important to know if it is a string or not) into ints... if so,
sscanf()
is done your you. otherwise, give more details about what you really have, and what you really want... cheers,It is an array BYTE data[212 Byte], i would like to chanage the hex values saved in the array to int values, as i should decode the polar coordinates from the Hex values saved in the data array.
-
It is an array BYTE data[212 Byte], i would like to chanage the hex values saved in the array to int values, as i should decode the polar coordinates from the Hex values saved in the data array.
-
this doesn't mean anything to convert from hexadecimal to int... hexadecimal IS an integer, but it only differs from the graphical representation... if you have 32 apples, it is the same as having 0x20 apples... what you certainly mean however is reading hexadecimal characters from a string (but that is important to know if it is a string or not) into ints... if so,
sscanf()
is done your you. otherwise, give more details about what you really have, and what you really want... cheers,v2.0 wrote:
if you have 32 apples, it is the same as having 0x20 apples...
It reminds me of another discussion[^] :laugh:
-
v2.0 wrote:
if you have 32 apples, it is the same as having 0x20 apples...
It reminds me of another discussion[^] :laugh:
-
Cedric Moonen wrote:
It reminds me of another discussion[^]
exactly... :-D i wanted to link the post, but couldn't find it... the comparison still deserves '5' :rose:
Ya i got it guys....actually am alramed, i would like to convert the Hex to decimal value
-
v2.0 wrote:
if you have 32 apples, it is the same as having 0x20 apples...
It reminds me of another discussion[^] :laugh:
I would like to convert Hex number i,e 40 or 0x0C or 0x04B to binary value or decimal value.
-
Hi, How to convert an array of Hex values to int in Visual C, is there any function for converting? chaitu
-
Ya i got it guys....actually am alramed, i would like to convert the Hex to decimal value
chaitanya22 wrote:
Ya i got it guys
Nope you didn't get it, otherwise you would not have asked again. What do you want to do EXACTLY ? And don't answer 'converting hex to decimal value' because this is totally nonsense ! Again, I will express it another way: it's like asking "I have 7 apples, I want to convert these apples in hexadecimal". Mmmmh, sounds, err, how to say....special, isn't ? This is the same for your question. So, formulate your question precisely. What do you want to do ? Convert a string representing a number ?
-
would that function convert Hex number to binary value? for eg:0x65=1100101,, i would like to ahve so...
-
I would like to convert Hex number i,e 40 or 0x0C or 0x04B to binary value or decimal value.
why not do :
int i = 0x30; // or whatever hex number you have...
Maximilien Lincourt Your Head A Splode - Strong Bad
-
would that function convert Hex number to binary value? for eg:0x65=1100101,, i would like to ahve so...
:(( :(( Even with the explanation of the apples you still don't get it. In other tearms: hex numbers and decimal numbers doesn't exist (it's a bad use of the language). Instead you should say hexadecimal REPRESENTATION or binary REPRESENTATION of a number. Let's take an example:
int BinValue = 0b1100101; // In binary
int HexValue = 0x65; // In hexadecimal
int DecValue = 101; // In decimalIn this example, all three numbers are exactly the same and if you compare them, the result will be true. Hope it is clear now.
-
Hi, How to convert an array of Hex values to int in Visual C, is there any function for converting? chaitu
Do you mean a string in hexadecimal format? You can do such a conversion with strtol. If you set the last parameter to 0 it does even automatically detect the number base depending on the first characters, e.g. if you have a string like 0xFF it will be converted to the integer value 255. Here is an example code:
const char* szNumber = "0x1234"; char* pHelp; int nNumber = strtol(szNumber, &pHelp, 0);
Regards Konrad