Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for dec2hex.kix

(view source code of dec2hex.kix as plain text)

  1. If $Dec = ""
  2. 	? "Enter a decimal value: "
  3. 	GetS $Dec
  4. EndIf
  5.  
  6. $DecVal = Val( $Dec )
  7. If "$Dec" <> "$DecVal"
  8. 	? "Dec2Hex.kix,  Version 1.00"
  9. 	? "Convert specified decimal number to 8 digit hexadecimal"
  10. 	?
  11. 	? "Usage:  KIX32  DEC2HEX.KIX  $DEC=number"
  12. 	?
  13. 	? "Where:  " + Chr(34) + "number" + Chr(34) + " is any decimal number ranging from 0..2147483647 (0x7FFFFFFF)"
  14. 	?
  15. 	? "Written by Rob van der Woude"
  16. 	? "http://www.robvanderwoude.com"
  17. 	?
  18. 	Quit 1
  19. EndIf
  20.  
  21. $Hex = DecToHex( $Dec )
  22.  
  23. $HLen = Len( $Hex )
  24. While $HLen < 8
  25. 	$Hex = "0" + $Hex
  26. 	$HLen = Len( $Hex )
  27. Loop
  28.  
  29. ? "$Dec = 0x" + $Hex
  30. ?
  31.  

page last modified: 2024-04-16; loaded in 0.0056 seconds