Best Api to unzip a file into memory - c++

I'm working on a Qt application where we have to read in zipped files or QByteArrays and unzip them in memory, reading the file contents without actually unzipping the file to disk.
Is there a good sdk that can enable this easily? We currently use QArchive (bugless), but we have found it to anything but bugless and are looking to move to a different solution.
Any advice is appreciated.
Thanks,
Liron

Have a look at Minizip that is included in the contrib section of zlib. It is very simple, but does the job well. More recent versions look like they handle passwords.

We ended up going with quazip. Thanks Eugen.
Seems to be working well.

Take a look at http://www.7-zip.org/sdk.html. It's licensed under public domain.

Related

Zip multiple files in C++

I have created ".tar" file and added multiple files in it while converting it to ".zip" i am facing problem.
I should create ".zip" for compress multiple files.
I need this in c++
code.BZ2 compression in C++ with bzlib.h I used this link to compress.
I tryed with http://www.winimage.com/zLibDll/minizip.html i feel its complicated.
please help me i am new to it Thank you so much in advance.
As far as I have used, Minizip is the best available open source to achieve this purpose. There are example classes, compress.c and uncompress.c which almost does everything related to zipping and unzipping

Free C/C++ based zip/zip64 library?

After having false starts with poco's zip and minizip (both have issues, minizip can't decompress files larger than 2gb and poco zip corrupts any zip file larger than 2 gigs it compresses) I was wondering if there was anything else left?
So any suggestions for a C++ archive library that can handle zip AND zip64?
7-zip handles both, as far as I could tell from a quick glance at their source code. It's also LGPL, which should allow its use in a closed source app.
Well there is the all-around very proven ZLIB : http://zlib.net/

Find out the mime type and associated applications with Qt

How can I find out a mime-type or content-type of a given file?
I cannot use the suffix because the file could be renamed.
Possible additions would be categorizing them as jpg, gif, png and so on are image files and can be opened by editing applications, which has been set in the OS.
Thank you in advance.
What platform? On *nix, you should refer to how the program file does it, which is based on a few heuristics including checks of the first few bytes of a file (many file formats start with a fixed header, including many image formats).
If you're on Windows, the *nix file command is probably still instructive, even if you can't reuse its code as directly. There may also be some better solution in the Windows APIs (I'm not a Windows programmer).
This could help, it is with C# but I think you can get the idea.
http://kseesharp.blogspot.com/2008/04/c-get-mimetype-from-file-name.html
You can use some sort of class for acccesing Windows Registry from qt or using the Windows API directly from qt.
I am not a qt programmer.
You can't, not from within Qt.
However, if all you want is to show a file with the correct application, you can use QDesktopServices::openUrl(), which wraps open (Windows/OSX) and xdg-open (Unix). The URL may also be a local file (in that case, use QUrl::fromLocalFile() to construct the URL).
For categorizing image files. For Qt and just only for image files.
QByteArray imageFormat = QImageReader::imageFormat(fileName); //Where fileName - path to your file
Further mapping imageFormat to mime-type is not complicable
It doesn't look like Qt offers that capability yet. However, you may want to look into the libmagic library which does what the file and other similar commands do. Assuming the library is maintained properly it will include new MIME types as time passes. From what I can tell it is part of the file tool suite. Under a Debian system do something like this:
sudo apt-get install libmagic-dev
to get the development library and use #include to make use of it.

where can I find 'pkunzip.cpp and pkunzip.h"?

somewhere, I found a simple source to read something, and that source includes
"PkunZip.cpp" and "Pkunzip.h" to read zip-file.
However, I could not find the website about PkunZip.cpp ( sourceforge or codeproject etc ).
where can I find the website that describe 'pkunzip.cpp' and a manual about it?
If you search google for either of these files nothing is returned. That is a pretty bad sign. If you need code to handle zip archives, I have used libarchive in the past with great success. Their website has great documentation and the code is cross platform (Windows, *BSD, Linux, etc).
You should be able to replace any missing functionality with libarchive.
The standard way of reading zip files is zlib, or considering you tagged c++, the zipios. But if you want your particular files, have you tried Google Codesearch?

creating zip file from a folder - in c++

I want to create a program that , when executed, will compress a selected folder.
Can it be done?
If you don't want to use boost, there's also zlib, along with minizip, which is a wrapper around zlib for managing zip files.
In C++ probably the best option is to go to the Boost library. You can find it here.