Slide 5.9: Constructors and operator overloading
Slide 5.11: Reading a stream of fields
Home

Field Structures


When we write out information as a stream of undifferentiated bytes, we lose track of the fields that make the information meaningful. For example,
   Powerpuff Girls 715 N 40th St., #202J, Grand Forks,
      ND 58203 123456789 11/11/1980 4
The above data is hard to comprehend without further information. There are many ways of adding structure to files to maintain the identity of fields. Five of the most common methods follow:

  • Force the fields into a predictable length.
    One obvious disadvantage of this approach is that adding all the padding required to bring the fields up to a fixed length makes the file much larger.