Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
14. Appending Files
Q:
Does anyone have a procedure/advice/whatever for adding several files
onto one file, then separating them back into the original files /w
filenames, properties, and everything? I was thinking of using the
Append() procedure, but that's for text files, and I'm working with
binary files (compressed, encrypted, what have you).
A:
What I would do is this:
First I create a TFileStream.
Then Write to it a blank but a fixed length header block .
This header block can contain anything you want to keep in
there; such as starting pos of each 'file', their lenths,
file names, copyright info etc.
Initially you can just write a blank header block to act
as place holder (you'll fill it up later)
Then create as many TMemoryStream as you have files/data/whatever.
Then using MyMemoryStream.SaveToStrea
one of those MemoryStreams into the FileStream. Making a note of
MyFileStream.Posotion and MyMemoryStream.Size.
Havin filled your MyFileStream with data, you can now set
FileStream,Position := 0
and fill up the header block you had rserved in the first step.
Retrieving each data block is simply a reverse of this.
[kanca@ibm.net]