I've been surfing the internet looking for the zlib static library -which is missing from the Qt/Symbian SDK. I downloaded and installed some old Symbian SDKs and finally found the needed files.
You can download them from this link
Here is a code example of how I used it:
You can download them from this link
Here is a code example of how I used it:
1 | LIBS+= -lefsrv -lezlib -leikcore -lcone |
1 2 3 4 5 6 | #include <ezgzip.h> #include <f32file.h> #include <ezcompressor.h> #include <ezdecompressor.h> #include <ezfilebuffer.h> #include <eikenv.h> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | void CompressFileL(QString sourceFile, QString destinationFile) { TPtrC16 aSrcFile( reinterpret_cast < const TUint16*>(sourceFile.utf16())); TPtrC16 aDesFile( reinterpret_cast < const TUint16*>(destinationFile.utf16())); CEZFileBufferManager* fileCompressor = NULL; CEZCompressor* comprsr = NULL; RFs iFs = CEikonEnv::Static()->FsSession(); RFile inFile,outFile; User::LeaveIfError(inFile.Open(iFs,aSrcFile,EFileRead)); CleanupClosePushL(inFile); User::LeaveIfError(outFile.Create(iFs,aDesFile,EFileRead | EFileWrite)); CleanupClosePushL(outFile); fileCompressor = CEZFileBufferManager::NewLC(inFile,outFile); comprsr = CEZCompressor::NewLC(*fileCompressor,CEZCompressor::EBestCompression); TBool res = EFalse; do { res = comprsr->DeflateL(); } while (res); CleanupStack::PopAndDestroy(4); //inputFile,outFile,fileCompressor,comprsr } void DecompressFileL(QString sourceFile, QString destinationFile) { TPtrC16 aSrcFile( reinterpret_cast < const TUint16*>(sourceFile.utf16())); TPtrC16 aDesFile( reinterpret_cast < const TUint16*>(destinationFile.utf16())); CEZFileBufferManager* fileCompressor = NULL; CEZDecompressor* decomprsr = NULL; RFs iFs = CEikonEnv::Static()->FsSession(); RFile inFile,outFile; User::LeaveIfError(inFile.Open(iFs,aSrcFile,EFileRead)); CleanupClosePushL(inFile); User::LeaveIfError(outFile.Create(iFs,aDesFile,EFileRead | EFileWrite)); CleanupClosePushL(outFile); fileCompressor = CEZFileBufferManager::NewLC(inFile,outFile); decomprsr = CEZDecompressor::NewLC(*fileCompressor); TBool res = EFalse; do { res = decomprsr->InflateL(); } while (res); CleanupStack::PopAndDestroy(4); //inputFile,outFile,fileCompressor,decomprsr } |
No comments:
Post a Comment