[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] map-file-to-memory and random access
From: |
Mark Voortman |
Subject: |
Re: [Chicken-users] map-file-to-memory and random access |
Date: |
Tue, 17 Apr 2007 16:27:18 +0200 (CEST) |
User-agent: |
SquirrelMail/1.4.9a |
> On 4/16/07, Mark Voortman <address@hidden> wrote:
>> >> I'm using map-file-to-memory to map a file in memory and then use
>> >> move-memory! to read/write the contents. However, I was wondering if
>> it
>> >> is possible to random access the memory mapped file? For example,
>> >> read/write only the bytes at position 5 to 10. If I use move-memory!
>> it
>> >> always starts reading/writing from byte 0.
>> >
>> > Right now, the only solution that comes to mind is to use
>> > "memory-mapped-file-pointer" and do really dirty pointer arithmetic
>> (see
>> > "pointer->address" and "address->pointer").
>> >
>> > Hm... "move-memory!" should probably get an additional argument giving
>> > an offset.
>> > What do you think?
>>
>> I think that's a good idea, but note that you'll need two additional
>> arguments. One offset for the source and one for the destination.
>
> I have implemented this and pushed it to the darcs repo.
Thanks!