I have code like this:
#include <libzip/zip.h>
void main()
{
int err;
struct zip* zip_file = zip_open("some_file.zip", 0, &err);
struct zip_file* file_in_zip = zip_fopen_index(zip_file_, 0, 0);
char buff[1024];
std::ofstream exctracted("extracted_data");
while((readed = zip_fread(file_in_zip, buff, 1024)) > 0)
{
exctracted.write(buff, readed);
}
zip_close(zip_file);
}
And what if I have not file on filesystem (like some_file.zip
), but only std::istream
instead? How to get struct zip*
object without saving stream to filesystem?
I see to the documentation of libzip, but can`t find out how to do that.