|
-
March 8th, 2004, 05:45 AM
#1
Only a quick question ...
Hi,
I realise this is probably the wrong area but
I need to find out the HEX Value for a character and pass this into a int
i know im being stupid but for the life of me i can't think how to do this
Any ideas ?
ie -
int nNum = 0
char ch = "A" // which should be 10
nNum = ch
please help !
Thank again
P
-
March 8th, 2004, 05:46 AM
#2
int nNum = 0;
char ch = 'A';
nNum = (int)ch;
/ Z
-
March 8th, 2004, 05:54 AM
#3
Sorry maybe i didnt make myself clear.
the value i want placed in the int is the Hexadecimal value of the char
ie char c = 'A' // which is 10
but what i get returned into my int is the value of 65 ?
any ideas what im doing wrong ?
P
-
March 8th, 2004, 06:03 AM
#4
const char* a = "A";
int zahl;
sscanf(a, "%x", &zahl);
is that what you mean?
-
March 8th, 2004, 06:04 AM
#5
Yep, Thats great !
Thanks to both of you ...
P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|