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!") )
	)
       ()
       )

Ask specific questions about how to code something in lisp, scheme, racket, etc

Common-Lisp Resources

General lisp discussion on lemmy.ml

Create Post From:
lemmy.ml

  • 0 users online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 3 users / 6 months
  • 5 subscribers
  • 3 Posts
  • 3 Comments
  • Modlog