symbian s60 实现 zip 文件解压到指定目录
2010-03-13 20:28:00 来源:WEB开发网if (fileName.Find(_L(".")) > 0)//if not dir
{
RFile file;
User::LeaveIfError(file.Replace(aFileSession, fileName, EFileWrite));
CleanupClosePushL(file);
User::LeaveIfError(file.Write(*buffer));
CleanupStack::PopAndDestroy();//file
}
CleanupStack::PopAndDestroy(3);//member,buffer,stream
}
CleanupStack::PopAndDestroy(); // members
}
//Add
by windcao
LOCAL_C void ExtractionAllL(RFs& aFileSession, C
type="text/javascript"
src="http://hi.images.csdn.net/js/blog/tiny_mce/themes/advanced/langs/zh.js"
mce_src="http://hi.images.csdn.net/js/blog/tiny_mce/themes/advanced/langs/zh.js"><>
type="text/javascript"
src="http://hi.images.csdn.net/js/blog/tiny_mce/plugins/syntaxhl/langs/zh.js"
mce_src="http://hi.images.csdn.net/js/blog/tiny_mce/plugins/syntaxhl/langs/zh.js"><>ZipFile&
aZipFile, const TDesC& aPath)
{ CZipFileMemberIterator* members = aZipFile.GetMembersL();
CleanupStack::PushL(members); CZipFileMember* member; while ((member =
members->NextL()) != 0) { RZipFileMemberReaderStream* stream;
aZipFile.GetInputStreamL(member, stream); CleanupStack::PushL(member);
CleanupStack::PushL(stream); // Extracts aFileName to a buffer. // If
the file is quite huge, then read the file in streaming mode. // For
example, use 4KB buffer and read it in an active object. HBufC8* buffer
= HBufC8::NewLC(member->UncompressedSize()); TPtr8
bufferPtr(buffer->Des());
User::LeaveIfError(stream->Read(bufferPtr,
member->UncompressedSize())); // Store the buffer to a file. // It
saves the file to KExtractedPath directory, the file name is the same
更多精彩
赞助商链接