Zip file using C program
Is there any opti开发者_如何学Pythonon to zip the file using C programme without using any external application (like Zip..)?
Of course, try using zlib. Or other libraries for compression. You can also code the compression algorithm yourself, but that might be too time consuming. Since you did not specify why do you need this, i can't give you a better answer.
Please find the link for some of the compression libraries available. It depends on the system you are using and the features you want. Zlib is one which i would recommend because of the configurable features and user manual.
Have you checked 7-zip. It has a complete SDK, with example sources, and a lot of functionality. It is Open-source, and free :) Take a look here
A good wrapper around it is SevenZipSharp. Sample usage:
SevenZipCompressor compressor;
compressor = new SevenZipCompressor();
compressor.CompressionLevel = CompressionLevel.Ultra;
compressor.CompressionMethod = CompressionMethod.Lzma;
compressor.CompressionMode = CompressionMode.Create;
compressor.CompressFiles(archiveName, files2Add.ToArray());
精彩评论