Re: libbz2 question
Sean 'Shaleh' Perry [firstname.lastname@example.org] wrote:
> On 07-Mar-2000 Shao Zhang wrote:
> > Hi,
> > It seems that libbz2 does not have a function that similar to
> > fgets or gzgets.
> > Does anyone know how to do it using the libbz2 functions?
> my understanding is that you do the file reading in your own code (or another
> libraries) and simply pass the input to libbz2. The headers and what not
> should explain it. You can also grab the bzip2 source, as it uses the lib to
> do its work.
Thanks for the reply. But what I need is to get each line for a
.bz2 file recursively.
I have done this easily with the zlib1g library by using the
function gzgets which is very similar to fgets.
But in libbz2, the only file reading function is:
bzRead(&bzerror, bzFile, buf, 2048);
where it reads 2048 bytes to buf regardless the newline
character. And it would be too expensive to
uncompress the whole file first and then start reading using
standard libc functions.
Thanks for the help in advance.
Shao Zhang - Running Debian 2.1 ___ _ _____
Department of Communications / __| |_ __ _ ___ |_ / |_ __ _ _ _ __ _
University of New South Wales \__ \ ' \/ _` / _ \ / /| ' \/ _` | ' \/ _` |
Sydney, Australia |___/_||_\__,_\___/ /___|_||_\__,_|_||_\__, |
Email: email@example.com |___/