Discussion Board

Results 1 to 3 of 3

Thread: Extraction

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    13

    Unhappy Extraction

    Hi Friends,

    I am supposed to extract all contents present in a zip file.

    How do I carry out extraction using CZipFile?

    Please help.

    regards,
    Soumya

  2. #2
    Regular Contributor
    Join Date
    Mar 2008
    Location
    Bangalore, India
    Posts
    68

    Re: Extraction

    Reading a ZIP file in Symbian OS C++ can be done via a class called CZipFile. It is declared in zipfile.h. The library name is ezip.lib.

    The following example shows how to extract a specific file from a ZIP file.
    Code:
    // Create an instance of CZipFile.
    CZipFile* zipFile = CZipFile::NewL(fileSession, aCompressedFile);
    CleanupStack::PushL(zipFile);
     
    // Extract aFileName from the ZIP file.
    CZipFileMember* member = zipFile->CaseInsensitiveMemberL(aFileName);
    CleanupStack::PushL(member);
     
    // Use input stream to extract the file.
    // The input stream of a file inside ZIP file is RZipFileMemberReaderStream.
    // The method used to get the input stream is CZipFile::GetInputStreamL().
    RZipFileMemberReaderStream* stream;
    zipFile->GetInputStreamL(member, stream);
    CleanupStack::PushL(stream);
     
    // Read the file using input stream.
    // Before reading the file, the code allocates a buffer to store with
    // the size of member->UncompressesedSize().
    //
    // If the file is quite huge, do not use "one-shot" Read().
    // Instead, read using a small block of buffer and do it inside an
    // active object.
    HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize());
    TPtr8 bufferPtr(buffer->Des());
    User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize()));
     
    //
    // Do whatever we want with the buffer.
    //
     
    // Finally, do not forget to release all the allocated resources.
    CleanupStack::PopAndDestroy(4); // buffer, stream, member, zipFile

    Pramod
    "Nobody will believe in you unless you believe in yourself."

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    13

    Re: Extraction

    Hi Pramod,

    Thanks for the reply.

    I did what u suggested me...

    I got some panics which i resolved.

    But,when i click on the .zip file, It says Unrecoznized format

    regards,
    Soumya

Similar Threads

  1. Phone number extraction???
    By kaizenengg in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2008-03-27, 05:54
  2. 3595 phone number extraction
    By demirateser in forum Mobile Java General
    Replies: 6
    Last Post: 2005-08-31, 13:07
  3. extraction of color channels out of bitmaps
    By michael.schrenk in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-08-09, 15:44
  4. Extraction Of Themes From 7610 to PC
    By seikyo in forum General Development Questions
    Replies: 1
    Last Post: 2004-11-01, 09:41
  5. Extraction of a SIS file...
    By sbleriot in forum Symbian
    Replies: 1
    Last Post: 2003-10-14, 13:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×