943,083 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 232
  • C RSS
Feb 8th, 2010
0

Consulta

Expand Post »
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!!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cecilia_g1 is offline Offline
3 posts
since Feb 2010
Feb 8th, 2010
0
Re: Consulta
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.
Moderator
Reputation Points: 3275
Solved Threads: 885
Posting Sage
WaltP is online now Online
7,699 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: sem.h Problem
Next Thread in C Forum Timeline: How can I assign an hex value from a variable to other variable





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC