like some fellows before me I do want to inflate a gzip'ed file on the phone. How can I do this? There are few resources on the net - however I have created the following piece of code that compiles and executes fine. It simply does not create any output...
But there is another thing gzipConverter->InflateL(); will decopress only first block of your file you must decompress all file and use while( gzipConverter->InflateL()){}; or something.
Forum posts: 60
Your usage is correct
But there is another thing gzipConverter->InflateL(); will decopress only first block of your file you must decompress all file and use
while( gzipConverter->InflateL()){}; or something.
I've tried to modify your code to this:
RFile output;
output.Open(fs,
aDestination,EFileRead|EFileWrite|EFileShareAny|EFileStreamText);
CEZGZipToFile*gzipConverter ;
gzipConverter = CEZGZipToFile::NewL(fs,aSource, output);
while( gzipConverter->InflateL()){};
delete gzipConverter;
gzipConverter = NULL;
output.Close();
and it's working !!!
Defalting works the same as Inflating just switch output and input
algis
Forum posts: 109
Yeah, you are right. There must be that while thing! With that, it works here too! Why they do not document such things???!!
br, Marcel
Forum posts: 2
I have this function in one of my project , got from a web site. But not working. Please Help!!
void DeCompressAFile(TDesC& aSrcName, TDesC& aDstName)
{
TBuf8<256> msg8;TBuf<256> msg16;
RFs fs;User::LeaveIfError(fs.Connect());
fs.SetSessionPath(_L("C:\\")); // change to your req. Path
RFile file;
TInt err = file.Open(fs,aDstName,EFileRead);
if(err != KErrNone)
{
msg8.Format(_L8("Error Reading File"));
msg16.Copy(msg8);
ERRDLG(msg16);
return;
}
msg8.Format(_L8("Before"));
msg16.Copy(msg8);
ERRDLG(msg16);
CEZGZipToFile *zip = CEZGZipToFile::NewLC(fs, aSrcName, file); //The function stops here witout crash and returns.
msg8.Format(_L8("CEZGZipToFile::before loop"));
msg16.Copy(msg8);
ERRDLG(msg16);
TInt tempi = 0;
while(zip->InflateL()) // while loop req. donot remove
{
tempi++;
}
msg8.Format(_L8("Completed"));
msg16.Copy(msg8);
ERRDLG(msg16);
CleanupStack::PopAndDestroy(); // zip
file.Close();
fs.Close();
}