Reputation: 359
I have the following problem:
I'm using zlib in C to gzip files. The compressing (using z_stream
, deflateInit2
...) is no problem, but I need to know the size of the gziped file before I compress it. Is this possible or is the only option I have to count the bytes while compressing?
Thanks in advance!
Upvotes: 0
Views: 265
Reputation: 67584
but I need to know the size of the gziped file before I compress it
If you mean that you need it to compress (perhaps to allocate a buffer to hold the data), then you are mistaking, the whole point of z_stream
is to let you compress input chunks in output chunks.
is the only option I have to count the bytes while compressing
Yes, you need to apply the compression algorithm to know the resulting size.
Upvotes: 2