hi,

On Tue, Apr 29, 2008 at 06:33:44AM -0700, Matthew Welland wrote:
> I'm using file-open and file-read and various blob to vector conversions to 
> read and parse binary files. Does anyone have any general suggestions or 
> guidelines for doing this efficiently? One possibility that occured to me 
> is to read large chunks into a blob and then process rather than reading 
> small chunks as needed. I'll probably give this a try but I'm hoping to 
> save exploring dead ends by tapping the wisdom of this group.

if your data can be represented as c-structs you could read it in some
malloc()ed memory block and then use accessors defined with
define-foreign-record.

or on unix you could mmap() it and then use define-foreign-record
accessors.

but this only works if the file really is laid out like a c struct
(and thus is not very platform independent).

i like peter seibel's binary file library in practical common lisp[1],
i always wanted to write something like that for chicken, but didn't
do it so far :(

hth&bye,
hans.

[1] http://www.gigamonkeys.com/book/practical-parsing-binary-files.html


_______________________________________________
Chicken-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to