sherman%v70nl.decnet@nusc-npt.arpa (V70NL::SHERMAN) (02/18/88)
There are many times in which I've had to access "card image" files from C. By this, I simply mean that each field of each record starts at a given "column", and occupies a fixed number of characters. Are there any opinions on the best way to access the information in such files? I can read(...) the number of characters in each record into a structure, but from comments I've seen, the layout of a structure is not guaranteed to be contiguous due to byte-alignment considerations. I can read each record into a simple array of bytes, and have a routine "peel" off each field. Perhaps read isn't the way to go anyway. Hmmm... And then it's annoying to have to trim trailing spaces from each of the character fields, and plop down '\0's at the ends. I've already written several programs that work fine, but I'm just curious how any/every body else does this. Bill Sherman, Sherman @ Nusc.arpa