zlib中基本函數(shù)都有哪些,相信很多沒有經(jīng)驗(yàn)的人對此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。
10余年的瀘州網(wǎng)站建設(shè)經(jīng)驗(yàn),針對設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)營銷推廣的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整瀘州建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)從事“瀘州網(wǎng)站設(shè)計(jì)”,“瀘州網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
獲取版本函數(shù):zlibVersion
壓縮函數(shù):deflateInit、deflate、deflateEnd
解壓縮函數(shù):inflateInit、inflate、inflateEnd
#include#include #include #include using namespace std; #define CHUNK 16384 int 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 : Z_NO_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 Z_OK; } int inf(FILE *source, FILE *dest) { z_stream strm; strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; inflateInit(&strm); int ret = Z_OK; 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 Z_OK; } void main(int argc, char *argv[]) { cout<<"zlibVersion:"< 此代碼參數(shù)官網(wǎng)示例代碼,本代碼為了學(xué)習(xí),只寫了最簡單的函數(shù),沒有錯誤處理。
看完上述內(nèi)容,你們掌握zlib中基本函數(shù)都有哪些的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!
本文標(biāo)題:zlib中基本函數(shù)都有哪些
當(dāng)前URL:http://weahome.cn/article/gedggp.html