In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
What are the basic functions in zlib? I believe many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Get version function: zlibVersion
Compression functions: deflateInit, deflate, deflateEnd
Decompression functions: inflateInit, inflate, inflateEnd
# include # include using namespace std;#define CHUNK 16384int def (FILE * source, FILE * dest, int level) {z_stream strm; strm.zalloc = Z null; strm.zfree = Z null; strm.opaque = Z null; deflateInit (& strm, level); int flush; int have; unsigned char in [CHUNK]; unsigned char out [CHUNK] Do {strm.avail_in = fread (in, 1, CHUNK, source); strm.next_in = in; flush = feof (source)? Z_FINISH: Zhuan NOAA flush; do {strm.avail_out = CHUNK; strm.next_out = out; deflate (& strm, flush); have = CHUNK-strm.avail_out Fwrite (out, 1, have, dest);} while (0 = = strm.avail_out);} while (Z_FINISH! = flush); deflateEnd (& strm); return Zero OK;} int inf (FILE * source, FILE * dest) {z_stream strm; strm.zalloc = Zero null; strm.zfree = Z_NULL Strm.opaque = Zero null; inflateInit (& strm); int ret = Zambiok; int have; unsigned char in [CHUNK]; unsigned char out [CHUNK]; do {strm.avail_in = fread (in, 1, CHUNK, source); strm.next_in = in If (0 = = strm.avail_in) break; do {strm.avail_out = CHUNK; strm.next_out = out; ret = inflate (& strm, Z_NO_FLUSH) Have = CHUNK-strm.avail_out; fwrite (out, 1, have, dest);} while (0 = = strm.avail_out);} while (Z_STREAM_END! = ret); inflateEnd (& strm); return Zerook;} void main (int argc, char * argv []) {cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.