Re: Help reading structured binary files



Bruce Roberts wrote:
Type
pLoadRec = ^ tLoadRec;
tLoadRec = packed record
    id : ShortInt;
    data : string [255];
    terminator : array [0 .. 1] of byte;
    end;

The simplest way to load the records with this type would be a file of
tLoadRec. A (file) stream would also work and might prove more flexible.

The only part of the entire file that will match the layout of that record is the very end of the file, and then only if the data length for that part of the file is 255 bytes. (The terminator designates the end of the _file_, not the end of a record.)


The structure, as Robert described, is of variable length, but Delphi records aren't.

--
Rob
.