io - How to write gz file in C via zlib and compress2 -
i'm using zlib write program compress data in several threads. can't use gzwrite. i'm using compress2().
*dest_len = compressbound(log_buff_sz); err = compress2((bytef*)compressed_buff->buff, dest_len, (bytef*)b->buff, size, gz_int_compression_level); write(fd, compressed_buff->buff, compressed_buff->full);
but when try decompress file via gzip -d see next output: "not in gzip format". doing wrong? thank answers
compress()
, compress2()
compress zlib format, not gzip format. need use lower-level functions able select gzip format. deflateinit2()
, deflate()
, deflateend()
. read documentation in zlib.h functions. after that, should @ heavily documented example of use.
Comments
Post a Comment