Re: [AD] implementing seek |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2010-04-07, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> On April 7, 2010, Peter Wang wrote:
> > On 2010-04-07, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> > > My proposal is that some form of this is added to the core I/O
> > > routines (not an addon). And subsequently, anybody who wants to treat
> > > a sub part of a file as a single entity to a loader / saver function
> > > must explicitly set up a splice.
> >
> > Yes. I'm not sure how a splice will work for saving though.
>
> Probably like any handle would, except it gets EOF when/after it reaches the
> end of the slice. so its impossible to overwrite past the end.
I was wondering how the user would know how big to make the slice,
ahead of time.
Ok, if the al_fopen_slice 'length' parameter is a _maximum_ length,
then you can pass INT_MAX or some other big number. When the slice is
closed we set the file position to initial_slice_pos + max_slice_length,
or the end of the file, which comes first.
Peter