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 = atoi(aux);

atoi(aux) return for example 40, then I want to see the value 40 on the buffer, 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!!!

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.