Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. need help to check my code why unzip operation not working

need help to check my code why unzip operation not working

Scheduled Pinned Locked Moved C / C++ / MFC
htmlcomhelptutorialquestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 4201820
    wrote on last edited by
    #1

    Hi All, i download opensourcecode to unzip a folder from below path ------http://www.winimage.com/zLibDll/minizip.html------- ->How to get the Minizip package and then 1.1 with zip64 support i want to unzip a folder to another location. Lets say if the zip file is at C:\\temp\\aaa.zip i want to unzip aaa.zip at C:\\temp\\abcd\\aaa once i download the files from the above link i get Unzip.h file and use unzOpen() function. but unfortunately, its not working as per my expectation. is there any body who can help me ? below is my code : *************************************************************** HRESULT UnZipFile(CAtlString srcPath, CAtlString tgtPath,CAtlString& errorMessage) { HRESULT hr=NOERROR; CAtlString message; INT result=0; unzFile pZipFile=unzOpen((CAtlStringA)tgtPath); if(pZipFile==NULL) { hr=E_FAIL; message.Format(_T("Failed to open a zip file.\r\n%s"), tgtPath); errorMessage=message; } return hr; } ***************************************************************** Kind regards, Praveer

    T C D 3 Replies Last reply
    0
    • M Member 4201820

      Hi All, i download opensourcecode to unzip a folder from below path ------http://www.winimage.com/zLibDll/minizip.html------- ->How to get the Minizip package and then 1.1 with zip64 support i want to unzip a folder to another location. Lets say if the zip file is at C:\\temp\\aaa.zip i want to unzip aaa.zip at C:\\temp\\abcd\\aaa once i download the files from the above link i get Unzip.h file and use unzOpen() function. but unfortunately, its not working as per my expectation. is there any body who can help me ? below is my code : *************************************************************** HRESULT UnZipFile(CAtlString srcPath, CAtlString tgtPath,CAtlString& errorMessage) { HRESULT hr=NOERROR; CAtlString message; INT result=0; unzFile pZipFile=unzOpen((CAtlStringA)tgtPath); if(pZipFile==NULL) { hr=E_FAIL; message.Format(_T("Failed to open a zip file.\r\n%s"), tgtPath); errorMessage=message; } return hr; } ***************************************************************** Kind regards, Praveer

      T Offline
      T Offline
      tagopi
      wrote on last edited by
      #2

      Hello, Did you check what this E_FAIL is returning ? Regards, Gopi.

      1 Reply Last reply
      0
      • M Member 4201820

        Hi All, i download opensourcecode to unzip a folder from below path ------http://www.winimage.com/zLibDll/minizip.html------- ->How to get the Minizip package and then 1.1 with zip64 support i want to unzip a folder to another location. Lets say if the zip file is at C:\\temp\\aaa.zip i want to unzip aaa.zip at C:\\temp\\abcd\\aaa once i download the files from the above link i get Unzip.h file and use unzOpen() function. but unfortunately, its not working as per my expectation. is there any body who can help me ? below is my code : *************************************************************** HRESULT UnZipFile(CAtlString srcPath, CAtlString tgtPath,CAtlString& errorMessage) { HRESULT hr=NOERROR; CAtlString message; INT result=0; unzFile pZipFile=unzOpen((CAtlStringA)tgtPath); if(pZipFile==NULL) { hr=E_FAIL; message.Format(_T("Failed to open a zip file.\r\n%s"), tgtPath); errorMessage=message; } return hr; } ***************************************************************** Kind regards, Praveer

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        Quote:

        its not working as per my expectation

        What are your expectations and what is the observed behaviour?

        Veni, vidi, vici.

        M 1 Reply Last reply
        0
        • C CPallini

          Quote:

          its not working as per my expectation

          What are your expectations and what is the observed behaviour?

          Veni, vidi, vici.

          M Offline
          M Offline
          Member 4201820
          wrote on last edited by
          #4

          Hi, the expected behavior is program should unzip the folder

          S 1 Reply Last reply
          0
          • M Member 4201820

            Hi All, i download opensourcecode to unzip a folder from below path ------http://www.winimage.com/zLibDll/minizip.html------- ->How to get the Minizip package and then 1.1 with zip64 support i want to unzip a folder to another location. Lets say if the zip file is at C:\\temp\\aaa.zip i want to unzip aaa.zip at C:\\temp\\abcd\\aaa once i download the files from the above link i get Unzip.h file and use unzOpen() function. but unfortunately, its not working as per my expectation. is there any body who can help me ? below is my code : *************************************************************** HRESULT UnZipFile(CAtlString srcPath, CAtlString tgtPath,CAtlString& errorMessage) { HRESULT hr=NOERROR; CAtlString message; INT result=0; unzFile pZipFile=unzOpen((CAtlStringA)tgtPath); if(pZipFile==NULL) { hr=E_FAIL; message.Format(_T("Failed to open a zip file.\r\n%s"), tgtPath); errorMessage=message; } return hr; } ***************************************************************** Kind regards, Praveer

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Member 4201820 wrote:

            i want to unzip aaa.zip at C:\\temp\\abcd\\aaa

            Does that folder exist? If not, will unzOpen() create it? What is the value of tgtPath? Have you tried sending an email to info@winimage.com?

            "One man's wage rise is another man's price increase." - Harold Wilson

            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

            "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

            1 Reply Last reply
            0
            • M Member 4201820

              Hi, the expected behavior is program should unzip the folder

              S Offline
              S Offline
              Stefan_Lang
              wrote on last edited by
              #6

              How so if you don't even use the source path in your code? P.S.: More to the point, you don't call any functions to actually unzip anything! Unzopen fails, because it expects the zip file name/path, but you are passing to it the target path, which presumably is a directory, not a file at all. NMo wonder it doesn't work! Moreover, unzOpen only provides a handle to the zip file that lets you access the individual files contained within, you need to use variuous other functions to walk over the list of files, find their relative path, and extract it to the target location.

              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups