help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Lisp - Reading a sequence of bytes as one integer


From: Jeff Clough
Subject: Re: Emacs Lisp - Reading a sequence of bytes as one integer
Date: Sat, 13 Mar 2010 13:10:29 -0500 (EST)

From: Teemu Likonen <tlikonen@iki.fi>
Date: Sat, 13 Mar 2010 19:15:49 +0200

> You can use the Lisp reader:
> 
>     (read "123") => 123
> 
> The argument for READ can also be a buffer or a marker, for example. See
> its documentation for more info.

This is not seeming to work, and I'm not seeing how to make it work.
I can't tell if this is just my not getting something, or if it isn't
the right tool for the job.  Just in case, here's an example of what
I'm needing...

At certain positions in the file (and I can already find them), I need
to read a sequence of three bytes as an integer.  If I do a "hexdump
-c" on the file, I can see that those three bytes look like this "\0
\0 \t", which would give me a decimal value of 9 if read as a single
integer.  If I grab this sequence from the file using buffer-substring
and pass it to read, I get an end-of-file error.

Is there some general way I can tell emacs "Take the three bytes
following point and make one integer out of them"?

Thanks!

Jeff




reply via email to

[Prev in Thread] Current Thread [Next in Thread]