Re: code to list contents of zip files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Prasanta Sadhukhan wrote:

> I tried to rectify the flaw and now I am getting the whole file contents 
> from the zip file, ie., it is outputting the contents of the file stored 
> in the zipfile.
> But Actually, I wanted only to list the content of the zip file as 
> zipinfo does.

In which case, rather than inflating the data, just skip the number of
bytes indicated by the compressed size field (LOCSIZ), and you should
find a data descriptor, then another header (not necessarily another
local file header; the last file will be followed by a central
directory header).

But for listing, you're probably better off just listing the central
directory, which is found at the end of the file.

This will work even if there is other data at the beginning of the
file (e.g. self-extracting EXEs have the EXE portion at the beginning
of the file and the ZIP data at the end).

I found the unzip source code to be rather messy, due to all of the
platform-specific sections. You might be better off referring to the
format specification at:

http://www.pkware.com/documents/casestudies/APPNOTE.TXT

-- 
Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux