Does anyone have a decimal to hexadecimal routine. I had no problem producing a hexadecimal to decimal routine, but I seem to have run into a problem producing a decimal to hexadecimal routine.
Announcement
Collapse
No announcement yet.
Decimal to hexadecimal routine
Collapse
X
-
Note that you should prefix the hex string with a leading zero to ensure that the value is treated as an unsigned value:
A$ = "FFFF"
PRINT VAL$("&H" + A$)
PRINT VAL$("&H0" + A$)
Results:
-1
65535
Also note that VAL() is capable of working with binary and octal strings too:
A$ = "1010101"
PRINT VAL("&B0" + A$)
A$ = "76543"
PRINT VAL("&O" + A$)
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>Lance
mailto:[email protected]
Comment
Comment