欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

zlib中基本函數(shù)都有哪些

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 <iostream>
#include <string>

#include <zlib.h>
#include <zconf.h>

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:"<<zlibVersion()<<endl;

	FILE *fp1 = fopen("1.txt","rb+");
	FILE *fp2 = fopen("2.txt", "rb+");
	FILE *fp3 = fopen("3.txt", "rb+");
	if((NULL == fp3) || (NULL == fp3) || (NULL == fp3))
	{
		cout<<"fail to open file."<<endl;
		return;
	}

	//壓縮
	def(fp1, fp2, Z_DEFAULT_COMPRESSION);

	//解壓縮,這個(gè)2個(gè)函數(shù)要分別調(diào)用。
	inf(fp2, fp3);
}

此代碼參數(shù)官網(wǎng)示例代碼,本代碼為了學(xué)習(xí),只寫了最簡單的函數(shù),沒有錯(cuò)誤處理。

看完上述內(nèi)容,你們掌握zlib中基本函數(shù)都有哪些的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

網(wǎng)站名稱:zlib中基本函數(shù)都有哪些
本文網(wǎng)址:http://chinadenli.net/article18/gedggp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化外貿(mào)網(wǎng)站建設(shè)、Google、搜索引擎優(yōu)化手機(jī)網(wǎng)站建設(shè)、軟件開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名