How to convert to and from HEX?

new topic     » topic index » view thread      » older message » newer message

I am able to convert a sequence to hex for storage in a bin file but how do I convert it back?

As in if I have a sequence "12" and pass that through th following function I get the desired result. But how can I convert that back again

function HToI(sequence Hex) -- convert hexadecimal string to integer 
integer n 
   n = 0 
   for i = 1 to length(Hex) do 
     if Hex[i] >='A' then 
       n = n * 16 + Hex[i] - 'A' + 10 
     else 
       n = n * 16 + Hex[i] - '0' 
     end if 
   end for 
   return n 
end function 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu