Elisp has a lot of functions for manipulating buffers opened in the editor, but it doesn't seem to have any raw file operations. Maybe what I need is in there, but I'm missing it.
How do you open a stream and read bytes from it? The Common Lisp equivalent would be:
(defvar stream (open "example.txt" :element-type '(unsigned-byte 8)))
(defvar byte (read-byte stream))
You can't do that directly.
Either you read the file into a buffer (with insert-file-contents
, which actually can also insert a subrange of the file's bytes), or otherwise you create a process that runs cat
on the file.