954,480 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Consulta

How can I do assign a Hex value to variable from other variable.

I mean I have this:
buffer is a char array
aux is a chara array

buffer[i] = atoi(aux);

atoi(aux) return for example 40, then I want to see the value 40 on the buffer[i], but is not the case the value is 28 (is 40 in hexadecimal)

How can I get the value stored be 40????!!!!!!!

I know if I do this value = 0x40, then 40 is stored but how can I do getting the value from other variable.

I really need this, thanks a lot for your help!!!

cecilia_g1
Newbie Poster
3 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
 

When talking about integers, they are all stored in binary. You can display them in decimal, hex, octal, sixbit, etc. but they are all in binary. To see the value in hex, all you need to do is output with the proper format specifier: %X-hex, %d-decimal, etc.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You