I have started working with the libzip library today. But I do not understand the principle how libzip works.
My focus is on zipping a directory with all the files and dirs within into a zip-file.
Therefore, I started with zip_open()
, then I read the directory
contents and add all the dirs with zip_dir_add()
to the archive.
After that, I closed the zip-file with zip_close()
. Everything was
fine. The next step should be to add all the files to the archive with
zip_file_add()
. But it doesn't work. The last step closing the file
fails.
OK, I forgot to create a zip_source to get this done. I added a
statement a line before to get this source (zip_source_file()
). But
still it doesn't work.
What is wrong in my thinking? Do I have to fopen()
and fclose()
the file on the filesystem also?
And what is the difference between zip_source_file() and zip_source_filep()?