Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 739 Bytes

sample_260.md

File metadata and controls

39 lines (27 loc) · 739 Bytes

Home

Converting an integer value to a hexadecimal string

Before you begin:

Check reverse example Converting a hexadecimal string to an integer.


Code:

? int2hex(100)

FUNCTION  int2hex (num)
	DECLARE INTEGER wnsprintf IN Shlwapi;
		STRING @lpOut, INTEGER cchLimitIn,;
		STRING pszFmt, INTEGER

	LOCAL lnResult, lcResult
	lcResult = SPACE(20)
	lnResult = wnsprintf(@lcResult, 20, "%x", num)
RETURN Left(lcResult, lnResult)  

Listed functions:

wnsprintf

Comment:

This can also be done with:

TRANSFORM(num, "@0")

not including VFP3.