I am thinking of creating a archive format similar to that of the MoPaQ used by blizzard entertainment, but there are a few things that I do not understand completely.

1) What is the best method for padding to make certain offsets certain.
Such as offset
  1. 0x00 Version String ( 1.1B )
  2. 0x04 Hash Table Offset ( i.e. 123456789 )
  3. 0x08 MetaData Table Offset ( i.e. 2395321 )
  4. 0x0A BlockSize ( i.e. 1024 )
I guess my main question is. If I write 123456789 to file it will take 9 bytes. Is there a way to make that only take 4 bytes of file space? Or else how can I maintain a consistent padding. So, Locations can be known before writing.