   Building a Container File
  How would one go about building a container file.  I'm taking about a file that contains other files, such as wad files in doom, or pak files in quake.  What is the general theory behind this?   
  In practice? Just use a zip file, rename the file extension to something like .dat or .pak and use an existing library to read it like  PhysFS.   ;Quote:Original post by scarypajamasHow would one go about building a container file.  I'm taking about a file that contains other files, such as wad files in doom, or pak files in quake.  What is the general theory behind this?Theory? Well, there is no general rule. For my format i use the 3 part approach.1) Header to identify the type2) Files table (name, type, offset, length, etc..)3) Files data.But you can mix it, use less or more parameters etc...as you need. It is quite simple to make a personal format. (or if you don't need additional information, you can use the ZIP format for example)   ;  Thanks for the replies.Quote:In practice? Just use a zip file, rename the file extension to something like .dat or .pak and use an existing library to read it like  PhysFS.I know zip files are nice for this sort of thing, and yes, in practice I too would use them.  It's just that, I'm working on my undergraduate in comp sci and I'm interested in the theory behind it.  I'd like to try to build my own, just for the learning experience.Quote:Theory? Well, there is no general rule. For my format i use the 3 part approach.1) Header to identify the type2) Files table (name, type, offset, length, etc..)3) Files data.Thanks, I think this is what I was looking for.   ;Quote:Original post by scarypajamasHow would one go about building a container file.  I'm taking about a file that contains other files, such as wad files in doom, or pak files in quake.I might point out here that quake's .pak files (and Java's .jar files) are just renamed zip files...   ;Quote:Original post by scarypajamasI'd like to try to build my own, just for the learning experience.Study the PNG image file format in detail. It's basically designed like a container, where just one of the "contained" things is the actual (compressed bitmap) image data.   ;Quote:Original post by scarypajamasI know zip files are nice for this sort of thing, and yes, in practice I too would use them.  It's just that, I'm working on my undergraduate in comp sci and I'm interested in the theory behind it.  I'd like to try to build my own, just for the learning experience.The theory behind them is that of flat file systems.Usually such archives are intended as read-only, which means they don't require majority of features that more complex file systems do. They are often also just an indexed table.Document file formats are often variations of journaling or versioning file systems.   