|
From: | David Hansen |
Subject: | Re: Efficiently checking the initial contents of a file |
Date: | Fri, 16 May 2008 13:12:58 +0200 |
User-agent: | Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) |
On Fri, 16 May 2008 03:16:13 -0700 (PDT) Nordlöw wrote: > How can I efficiently using pure emacs-lisp (without calling any > external process) investigate the first bytes of a file? > > My guess is > - Open parts of the file into a buffer or string. > - Alt 1. Switch to the buffer and do things. (with-temp-buffer ;; Read the first 42 characters (not bytes) into the temp buffer. (insert-file-contents filename nil 0 42) ;; Do whatever you want to do here. ) David
[Prev in Thread] | Current Thread | [Next in Thread] |