Codesnippets > Math

Hex To Decimal and Decimal to Hex

<< < (3/3)

Qedo:
Thanks Gernot for the great help  :booze:, However for high hex, like 0xFFFFFFFF the strtol function overflows. It seems to be better strtoul.
ad maiora

a#=hex2dec("F234FFF0")
PRINT a,0,0
SHOWSCREEN
MOUSEWAIT
END

IMPORT "C" unsigned long strtoul(const char* str, int endptr, int base)
FUNCTION hex2dec#: str$
   LOCAL n# = strtoul(str$, 0, 16)
   RETURN n
ENDFUNCTION

Navigation

[0] Message Index

[*] Previous page

Go to full version