1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

unzip via C++

Discussion in 'Mac Programming' started by nunyabeezwax, Mar 19, 2008.

  1. macrumors newbie

    I have an application that downloads updates to support files and the application itself from a web server. I want to be able to unzip the file while it is still in memory and then save it uncompressed. Right now I am just saving the zip file and decompressing it manually. I am looking for a code sample or a hint to a function or even a way to do this with BOMArchiveHelper.


  2. macrumors 65816

    You can probably find what you need here.
  3. macrumors newbie

    Thanks for the quick reply, but I was looking for an intrinsic solution either via a function or a call to an external program like BOMArchiverHelper.

  4. macrumors 6502a

    Why not use the unzip command - should be possible to issue command line calls from within a program...

    like this... http://maccoder.blogspot.com/2007/04/interacting-with-command-line-in.html

    Guess you could make the call to execute BOMArchiveHelper, but I've found on several occasions that it will not always work with files from Windows systems. The unzip command line utility (included with OS X) is more reliable.

    Just fire up the terminal and type "man unzip" to see more
  5. macrumors newbie

    Thanks, that is a great help and I will give it a go but my goal is still to call a function and not a outside program. So if anyone else has a suggestion it would be appreciated.

    Thanks again,

  6. macrumors 603


    Look around for a zip library. It would be much easier though just to use a system() call.

    You won't just find a single function solution with a zip file I'm afraid if you go the library route. You'll still need to read the file, process it and write the data back to another file.

    Edit : Here you go : http://www.zlib.net/
  7. macrumors newbie

    I have already completed this code for win but when I attempted to compile the zip code for Mac there were plenty of errors. So, I was just thinking that there would be a Mac function(and yes I realized it could be several functions) but I could not find it via my searching so I was relying on help here. The boss isn't real happy about the system call(neither of us has any experience with them) and I didn't want to fix all the errors but I guess I will have to!

    Thanks to everyone who helped or anyone else that may have an alternate solution,


Share This Page