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

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

Re: Parsing Windows .lnk file in elisp


From: Matthew Kennedy
Subject: Re: Parsing Windows .lnk file in elisp
Date: Thu, 03 Jul 2003 14:55:37 GMT
User-agent: Gnus/5.090024 (Oort Gnus v0.24) Emacs/21.3.50 (gnu/linux)

brakjoller@hotmail.com (Barman Brakjoller) writes:

> Anyway, how does one do these things in emacs? I tried to find some
> low-level functions like read and seek in the emacs lisp reference but
> I found none? Did I look to shallow into the manual or how do you do
> these kind of things in emacs, parsing binary file formats.
>
> I should note that I am a total newbie when it comes to parsing binary
> files, so I need some pointers.

If I were trying it, I would insert the .lnk file into an emacs buffer
and then return the buffer as a string.  Something like this perhaps:

(defun lnk-as-string (lnk-file)
  (with-temp-buffer
    (insert-file lnk-file)
    (buffer-string)))

And then use the ordinary aref or subseq functions to access each
bytes:

(let ((lnk (lnk-as-string "/bin/ls")))
  (subseq lnk 1 4)) => "ELF"
  
Matt

-- 
Matthew Kennedy


reply via email to

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