I mean that you need to write each file section as a binary image, i.e. copy from its original location as a binary stream, into the new file. As you add each section you create an index (of your own design) which contains the file offset, length, and any other relevant information. After adding the last binary image to your file you then write your index (making a note of its file offset), and then finally write that offset location to the file, so that you can find the index when reading. Your file will then look something like:
Data file 1 (mp3) |
Data file 2 (txt) |
Data file 3 (avi) |
Data file 4 (pdf) |
Index |
pointer to index |
The Index is just a table which contains the pointers to the data files.
In order to read any file you just need to find the index (from the last word in the file), get the offset and length of the file, and read from that point.
An alternative solution would be to use SQL Compact Edition which would give you equal control, but with a ready made program to control the management of your data, allowing insertion, updating and extraction with the minimum amount of work on your part.