Il giorno gio 24 ott 2024 alle ore 18:56 Marius Spix
<marius.s...@web.de> ha scritto:
>
> Mhhhh,
>
> char *buf = xmalloc (offset_option);
> ...
> free (buf);
>
> Reading lots of data into a huge buffer just to free it later does not sound 
> like a good idea. There are more efficient ways to fast-forward a tape or to 
> receive a file stream starting at a certain offset (pipe dd through tar).
>

Hi,
yes, the buffer could be big. A better option could be to lseek(), but
that won't work with pipes.
Alternatively, I could create a decent sized buffer, e.g. a few Kb,
and read in a loop until needed.

I know that it's possible to pipe the stream with an external process,
but there are some use cases where a seekable file descriptor is
preferable.
One for all, listing the content of a huge archive is much faster when
tar can seek forward.

> Regards,
>
> Marius
>
>
>

Regards,
-- 
Matteo Croce

perl -e 'for($t=0;;$t++){print chr($t*($t>>8|$t>>13)&255)}' |aplay

Reply via email to