1. converting hex to decimal...
Hia all...
I'm stuck trying to convert hex numerals to normal numbers...
The hex numbers are strung together in a file like:
1F0AB420FF1C
which seems impossible to decode, but it's number every 2 digits, eg:
[1F] [0A] [B4] [20] [FF] [1C]
is the same sequence broken into number lots.
I can do that okay, but i am having trouble converting #FF to 255 etc
and 255 to #FF
any help greatly appreciated... :)
advaTHANKSnce <-(thanks in advance)
Mike Fowler - mike.fowler at nelsun.gen.nz
o__ ---
_,>/'_ ---
(_) \(_) ---
Tip for the month: Buy a Pentium II - they reboot faster.
2. Re: converting hex to decimal...
> The hex numbers are strung together in a file like:
> 1F0AB420FF1C
> which seems impossible to decode, but it's number every 2 digits, eg:
> [1F] [0A] [B4] [20] [FF] [1C]
> is the same sequence broken into number lots.
>
> I can do that okay, but i am having trouble converting #FF to 255 etc
> and 255 to #FF
Ok, here it comes...
--code begins here --------- actually it begins at the next line ----
include get.e -- for value ()
function get_hex_value ( sequence hex_string )
sequence ret
ret = value ("#" & hex_string)
if ret[1] = GET_SUCCES then
return ret[2]
else
puts(1,"BAD HEX VALUE !!\n\n")
abort(1)
end if
end function
------------------------------ code ended line above -------
Just include the above in your program and all get_hex_value() to
get the heximal value. Exemple:
? get_hex_value("FF")
Will write 255 to the screen...
Your welcome...
Ralf Nieuwenhuijsen
nieuwen at xs4all.nl
3. Re: converting hex to decimal...
Mike Fowler wrote:
> I'm stuck trying to convert hex numerals to normal numbers...
>
I've got some functions. If you still need them tomorrow (after I
retrieve them from my work computer), I'll get 'em to ya. :)
Later!
ck
4. Re: converting hex to decimal...
Ralf Nieuwenhuijsen wrote:
> Ok, here it comes...
>
> --code begins here --------- actually it begins at the next line ----
> <SIMPLE CODE SNIPPED>
> ------------------------------ code ended line above -------
>
> Just include the above in your program and all get_hex_value()
> to
> get the heximal value. Exemple:
Zowie. I've been doing it way too complicated. I reversed the hex
sequence, calculated each position, yadda yadda yadda. Maybe this
listserver IS good for something! hehe
> Your welcome...
His welcome what?
Later!
ck