2

This is a first question on this StackExchange site, please let me know if my question is off-topic, and if so, which of the sites would be more appropriate.

I am looking for an API that can be used with ANSI C on a Windows 7 OS. I will use it to uncompress files created using WinZip, DynaZip, 7zip.

(I have observed that each of these seem to accommodate compression algorithms created by each other, i.e. 7zip opens/creates files that can be open/created by WinZip which can in turn be open/created by DynaZip)

So far I have tried to compile the offerings from 7zip and miniz using an ANSI C compiler in the LabWindows/CVI environment (C99 implementation), but ran into missing header files for both offerings. I have also looked at the Windows APIs in MSDN, but did not find anything there. Surprised at that, and wonder if I just was not looking in the right areas.

I suspect either of the offerings from 7zip or miniz would be perfect, except for the incomplete file distribution. Insights from others that have successfully built either of these APIs (in a Windows/C99 environment) would be helpful. Or if there is another approach completely, i.e. another API. Any help is appreciated.

  • Why does it have to be ANSI C? – Cristian Ciupitu Jul 21 '14 at 19:57
  • @CristianCiupitu - My customer is standardized on ANSI C, and the application with which I will use this API will be ansi C. If the API is written in C++, or C#, that is not a problem, it just has to have a way for me to link with it, i.e. delivered with .dll, .lib and .h. – ryyker Jul 21 '14 at 20:09
4

You can use LZMA SDK.

  • cross platform
  • ANSI C compatible
  • public domain license

You must tell your compiler where to look for headers or copy the headers to standard directories (see this).

  • LZMA requires using c++ for uncompressing .zip files according to its author. ANSI C compatibility seems to end with use only for LZMA compression. – ryyker Jul 26 '14 at 19:20
3

Perhaps libarchive is the answer, but I'm not sure if it's ANSI C. Though it's portable and works on most POSIX-like systems (including FreeBSD, Linux, Solaris, etc.) and supports Windows, including Cygwin, MinGW, and Visual Studio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.