lisp
Lisp Amicchan 2 years ago 100%

How do I insert control characters into a string with hex?

I'm trying to read a string and verify it's magic number (0xFEEDFACE); but I don't know how to insert an ascii character (as a number) into strings.

Here is my code:

;; Parser library for the Source Engine Nav mesh format.
(defun parse-nav-string (input-string) "Parses string as Nav file."
       ;; Test for magic string 0xFEEDFACE.
       (cond
	(string= (subseq input-string 0 3)
		 (concatenate (code-char #xCE) (code-char #xFA) (code-char #xED) (code-char #xFE))
		 )
	(t (format *error-output* "Magic string not found!") )
	)
       ()
       )

2
0
Comments 0