WEB开发网
开发学院手机开发Symbian 开发 symbian s60 实现 zip 文件解压到指定目录 阅读

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)

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< p>

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"><>< p>

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

Tags:symbian 实现 zip

编辑录入:coldstar [复制链接] [打 印]
赞助商链接