Turn a decimal number into hex ──────────────────────────────────────────────────────────────────────────────
Syntax
GT_DtoH(<n> [,<nLength>]) --> <cHex>
Arguments:
<n> is a decimal integer to convert
<nLength> is the MINIMUM length string to return. If the return string <cHex> is already longer than this, it is not truncated. If shorter, it is padded with leading zero's.
Returns:
<cHex> is a string representing a hexadecimal number.
Description:
This function allows you to convert from decimal to hex easily. There are many uses for hex numbres in Clipper.
Examples:
? GT_DtoH(255) // 'FF'
// This code builds attribute bytes... // // Attribute color table: // 0 = Black 8 = Grey // 1 = Blue 9 = Bright Blue // 2 = Green 10 = Bright Green // 3 = Cyan 11 = Bright Cyan // 4 = Red 12 = Bright Red // 5 = Magenta 13 = Bright Magenta // 6 = Brown 14 = Yellow // 7 = White 15 = Bright White
cAttribute := SubStr(SaveScreen(0,0,0,0),2,1) // get att. byte cAttribute := GT_DtoH(Asc(cAttribute)) // make 2bytes
/* now change background byte to bright/blinking white*/ cAttribute := GT_DtoH(15)+SubStr(cAttribute,-1)