Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Tom Rettigs Library - hex(<expn>) http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 HEX(<expN>)
 Converts a decimal number to hexadecimal (base 16).
 Returns <expC> hexadecimal value of <expN>.

 Returns a 4-byte string if -32768 <= <expN> <= 65535,
         otherwise an 8-byte string.

 Useful with functions and procedures providing low-level access,
 such as DOSFUNC and ROMBIOS, that require some parameters to be
 passed as hexadecimal strings.

 HEX(    16) returns "0010"
 HEX(    79) returns "004F"
 HEX(    -1) returns "FFFF"
 HEX( 65535) returns "FFFF"
 HEX( 32768) returns "8000"
 HEX(-32768) returns "8000"
 HEX(-32769) returns "FFFF7FFF"

 DO WHILE .T.
    ACCEPT "Enter a number: " TO m_dec
    IF [] = m_dec
       EXIT
    ELSE
       ? "Result: " + HEX( VAL(m_dec) )
    ENDIF
 ENDDO


             Placed in the Public Domain by Tom Rettig Assoc.

See Also: BIN() DEC()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson