问题
I have a question on zlib
. How can I know the number of compressed bytes written? I am using gzwrite(...)
. As we know it returns the number of uncompressed (actual) bytes written.
Should I use some other API instead of gzwrite()
?
What I am doing,
- I have a .gz output file. I keep writing to the file when I have some content available. I also want to track the file so that it does not cross a certain size. I do not want to use stat() linux API
as my writing is very frequent.
Suggestions?
回答1:
zlib provides the gzoffset()
function for this purpose. It returns the current offset in the file being read or written.
来源:https://stackoverflow.com/questions/23028323/how-to-get-number-of-compressed-bytes-written-while-using-gz-lib-in-c-c