Распаковать архив Zip в C++

Находил библиотеки для распаковки архива так и не смог их нормально подключить) существуют ли способы разархивировать архив стандартными способами в С++?


Ответы (2 шт):

Автор решения: Blackmeser

Стандартными нет способов, по вашему тегу visual-c++ - можно так:

#using <System.dll>
#using <System.IO.Compression.ZipFile.dll>
#using <System.IO.Compression.dll>
using namespace System;
using namespace System::IO;
using namespace System::IO::Compression;
int main()
{
    String^ zipfile = "F:\\testzip\\test.zip";
    String^ targetfolder = "F:\\testzip\\test";
FileStream^ f = gcnew FileStream(zipfile, System::IO::FileMode::Open);
    ZipArchive^ zip = gcnew ZipArchive(f, System::IO::Compression::ZipArchiveMode::Read);
    auto list = zip->Entries;
    Console::WriteLine(list->Count);
    for (size_t i = 0; i < list->Count; i++)
    {
        auto entry = list[i];
        auto path = Path::Combine(targetfolder, entry->FullName);
        Console::WriteLine(path);
        auto streamentry = entry->Open();
        auto dir = Path::GetDirectoryName(path);
        if (!Directory::Exists(dir))
            Directory::CreateDirectory(dir);
        FileStream^ bw = gcnew FileStream(path, System::IO::FileMode::CreateNew);
        streamentry->CopyTo(bw);
        bw->Flush();
    }
}
→ Ссылка
Автор решения: artEA

Нету функции в winapi, использовал более простой вариант без заморочки https://github.com/kuba--/zip простенькая но рабочая).

→ Ссылка