how to get number of compressed bytes written, while using gz lib, in c/c++?

痴心易碎 提交于 2019-12-02 06:29:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!