Hi
i have a string, eg.
000050000081E1500F01EE100AF8EE34101FE59A
i want to read it as different types., how do i read it as hex? decimal etc?
could someone post the code? thanks
also , what is the syntax for comparing two strings?
thanks
Chewbob : strcmp returns 0 if the strings are equal. So either !strcmp(str1, str2)
or strcmp(str1, str2) == 0
.
Last edited on
Ah, yes. Slipped my mind. I don't see the logic behind that, to be honest.
@petergrwl
You have two tasks
1. Split the string into its component parts
2. Convert each part into a number
To split the string, member functions like substr() will help.
To convert strings into numbers, a stringstream will help.
Good luck!
[edit]
@Chewbob
It is so you can write boolean expressions the same way you would with integer values
if (x1 < x2) ... // x1 < x2
if (strcmp( s1, s2 ) < 0) ... // s1 < s2
Etc.
Last edited on
Oh yeah, thanks. I should have just looked at the reference page.