Calculating the position of a file

Started by
3 comments, last by Hippokrates 21 years, 6 months ago
In my archive system I would like to know where a file is located within an archive. I can determine where it es when writing all the files to the archive. But this content is modified afterwards (compressed for example). So how can i possibly know where my file is after, for example, compressing my archive with zlib ?
Im Anfang war die Tat...Faust
Advertisement
ftell?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
ummm... I''d say uncompress the file with zlib, and then just reverse the algorithm used to store it.

Other than that, make sure that the header of the archive file has a table of contents that contains the offset and length of each file in the archive.

And enforce that any modification to the contents of the archive must update the table of contents as well.
daerid@gmail.com
You can''t. If it''s compressed, the information that used to be at byte 400 could be spread over several parts of the file after compression. Compressed files generally don''t have byte boundaries anyway--they''re usually bitstreams.
Well I have solved this problem now by applying each filter (for example compression) to each file separately and stuffing them into the archive afterwards.
Im Anfang war die Tat...Faust

This topic is closed to new replies.

Advertisement