Skip to main content
gamedev.net
🔒 Locked

Zip Files

Started by Terren 6 replies 350+ views
Original Post
Terren
Terren
Hey there I have written a class to open and manage uncompressed zip files to store my media on disk. Now, I want to add functionality which can create a new archive on disk, and add files to it, and I have done so. However, the problem is that Winzip does not recognise it as a valid Zip file, but my class that I have written will read it and process it absolutely fine, like it was any other zip file created by Winzip itself. And so my question is this - what element in the file headers triggers Winzip to not recognise the file, or TO recognise it, as it were? Has anybody else achieved this?
TangentZ
TangentZ
First of all, BRAVO for writing your own ZIP functions
instead of using the ultra-easy-to-use ZLIB.

Have you tried using something other than Winzip to read
your files? What do they say?



Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!
Terren
Terren
ta Yeah, I have this thing where I try to make as much for myself as I can, even tho I''d never heard of ZLIB before (probably because I''m an ignorant bastard). Hope your not being sarcastic tho!!


No - didn;t think of that -i''ll try it now
Terren
Terren
Mmmm - that''s interesting..

WinRar says that it found an unexpected end of archive ..

So does anyone know what ''Marks'' the end?
Terren
Terren
Ok - hang on

When reading an archive in, the loop stops when it finds a certain value in the ''Signature'' entry in the file header, which marks that there are no more local files, so what I did was, after writing all the file data to the file, write another header with this same value, which is why I think my class still reads it, and Winzip doesn''t, cos it wants something else. So does anyone know what should come after it for it to be Winzip compatible?
Neosmyle
Neosmyle
Try creating a zip file with winzip and add some files to it, then modify your class to dump whatever you don''t use in your program. Meaning - theres extra stuff at the end past what your class uses, and thats what WinZip/WinRar finds missing. So just modify your code to dump that section of the file. Hope that made sense.
Terren
Terren
That makes perfect sense actually - so much sense that i feel stupid now...

Thanks very much - will do that
TangentZ
TangentZ
I wasn''t being sarcastic.

Here is the link to ZLIB.
It''s definitely worth checking out.



Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.