I have code that reads from a bzip2-compressed file using the zlib compatibility functions. This works in principle but it turns out that reading stops after exactly 900,000 bytes, which is the block size used during compression. How do I read past the block boundary, into the next block, using these functions?
Here is some very basic test code (error handling removed):
BZFILE *h = BZ2_bzopen("file.bz2", "rb");
while( auto n = BZ2_bzread(h, buf, 1024) ) {
printf("%d bytes read\n",n);
ntot += n;
}
BZ2_bzclose(h);
printf("%ld bytes read\n",ntot);