;; | --------------------------------------------------------------------------- ;; | MI_itoh ;; | --------------------------------------------------------------------------- ;; | Function : Convert from a Base 10 integer to hexadecimal ;; | Argument : 'num' - Integer number ;; | Return : The hexadecimal string ;; | Update : August 6, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun MI_itoh (num / str int) (if (= num 0) (setq str "0") (setq str "")) (while (> num 0) ;positive? (setq str (strcat (if (> (setq int (rem num 16)) 9) ;process 1's (chr (+ 55 int)) ;convert A-F (chr (+ 48 int)) ;convert 0-9 ) str ;accumulate results ) num (/ num 16) ;powers of 16 ) ) str ;return result )