Store you're file header count at the end of the file, then when reading seek to the end of the stream ?¢_" sizeof(integer) and read the header count, seek back NumberOfHeaders * sizeof(THeader) and there you are.