ToDADS errata: Chapter 2: Arrays
published: Tue, 17-Jun-2003 | updated: Sat, 20-Aug-2016
1. Page 49. The code snippet changes the name of the file identifier half way through, from MyFile to the more illegible DF. The code should look like:
var MyRecord : TMyRecord; MyFile : file of TMyRecord; begin {open data file} System.Assign(MyFile, 'MyData.DAT'); System.Rewrite(MyFile); try {write a record to position 0} ..set fields of MyRecord.. System.Write(MyFile, MyRecord); {read the record from position 0} System.Seek(MyFile, 0); System.Read(MyFile, MyRecord); finally System.Close(MyFile); end; end;
Thanks to James Merrill.
2. Page 55. The var section for TtdRecordStream.rsReadHeaderRec is missing the declaration for TempHeaderRec. The code on the CD is correct; I managed to drop the definition when converting the code for the printed page. The var section should look like:
procedure TtdRecordStream.rsReadHeaderRec; var StreamSize : longint; TempHeaderRec : TtdRSHeaderRec; begin ...
Thanks to James Merrill.