symbian壓縮和解壓縮GZIP檔案

2021-05-21 14:22:30 字數 1804 閱讀 1172

開發夥伴平台:

s60 3rd edition, fp1

詳細描述

下列**片段演示了如何壓縮和解壓縮gzip檔案,這裡使用了cezfiletogzip類和cezgziptofi類。**可以通過自簽名執行。

mmp檔案

需要下列鏈結庫

code:

library efsrv.lib

library ezlib.lib

原始檔code:

#include 

#include

void compressgzipfilel(rfs &afs, tint abuffersize, const tdesc& afilename)

cleanupstack::popanddestroy(3); //filetogzip, input, compressedfile

}void decompressgzipfilel(rfs &afs, tint abuffersize, const tdesc& afilename)

cleanupstack::popanddestroy(3); //gziptofile, output, decompressedfile

}

使用compressgzipfilel()和decompressgzipfilel()方法

下面這個示例演示了通過讀取命令列引數來壓縮或解壓縮.gz檔案

選項:* -c = compress

* -d = decompress

* -b n = buffer size

* filename = gzip file

code:

void dogzipcompressionanddecompressionl()

hbufc *argv = hbufc::newlc(cmdlinelen);

tptr argptr=argv->des();

user::commandline(argptr);

tlex arguments(*argv);

tptrc options(arguments.nexttoken());

tbool buffersizespecified = efalse;

_lit(kinvalidoption,"invalid option %s/n");

_lit(kunknownoption,"unknown option %s/n");

_lit(knooptionspecified,"no option specified/n");

while (options[0]=='-' || buffersizespecified)

else}}

else

index++;

}if (index == 1)

}options.set(arguments.nexttoken());

}tptrc filenameptr(options);

hbufc *filenamebuf = hbufc::newlc(filenameptr.length());

*filenamebuf = filenameptr;

if(docompress)

compressgzipfilel(fs,buffersize,*filenamebuf);

else

decompressgzipfilel(fs,buffersize,*filenamebuf);

cleanupstack::popanddestroy(3); //filenamebuf,argv,fs

}

gz 檔案解壓縮命令

linux壓縮保留原始檔的 方法 gzip c filename filename.gz linux解壓縮保留原始檔的方法 gunzip c filename.gz filenam egunzip的用法 1.作用 gunzip命令作用是解壓檔案,使用許可權是所有使用者。2.格式 gunzip acf...

關於壓縮和解壓縮

從http www.icsharpcode.net 首先需要在專案裡引用sharpziplib.dll。然後修改其中的關於壓縮和解壓縮的類。實現原始碼如下 壓縮檔案 using system using system.io using icsharpcode.sharpziplib.checksum...

壓縮和解壓縮OLEVARIANT

uses zlibex procedure varianttostream const v olevariant stream tstream varp pointer begin stream.position 0 stream.size vararrayhighbound v,1 vararra...