I am creating a binary file, containing a record type i have defined, using the BLockWrite command.
I am then trying to read the data back again and i get 3 out of the 4 values in the record back and i can't work out why.
Code snippets below
Bits of Code below:
TYPE TTileRecord = PACKED Record
Min,Max,Avg,Std : Double
END; {TTileRecord}
RecTile : TTileRecord;
BIP : File;
iCount, iTransfer : Integer;
ReadBIP : File;
WHILE NOT EOF DO BEGIN
//RecTile.sTileName := UpperCase(FieldAsString('TILE_NAME'));
RecTile.Min := FieldAsFloat('MIN_DISTANCE');
RecTile.Max := FieldAsFloat('MAX_DISTANCE');
RecTile.Avg := FieldAsFloat('AVG_DISTANCE');
RecTile.std := FieldAsFloat('STD_DISTANCE');
BlockWrite(BIP,RecTile,iCount,iTransfer);
Next;
END;
iSeek := 0 //read the first record
Seek(ReadBIP,iSeek);
BlockRead(ReadBIP,RecTile,SizeOf(recTile),iRead);
When it runs it gives me:
iCount = 31
iTransfer = 31
SizeOf(recTile) = 32
iRead 32
I tried to do SizeOf(recTile)-1 but this didn't make any difference.
The values that were input were:
Min := 706503
Max:= 838374
Avg:=780866.691
Std:= 35813.041
It reads the first three fine but the std comes back as 1.9921665331e-304
Does anyone know how to fix this? (I am using Delphi 7)
Cheers
SeaZoneDev