Hi
I’m looking for a way to print a number (mostly a byte) in hex notation.
Does anybody know a simple solution for this ???
Kind regards ,
Ronny Suy
Hi
I’m looking for a way to print a number (mostly a byte) in hex notation.
Does anybody know a simple solution for this ???
Kind regards ,
Ronny Suy
Here’s one way:
(defun pc (i) (princ (code-char (+ i (if (<= i 9) 48 55)))))
(defun pb (i) (pc (ash i -4)) (pc (logand i 15)))
The function pc prints a hexadecimal character, and pb prints a byte.