| www.boyet.com | |||||||
| 
 | 
			Tomes of Delphi: This page describes the errata for Chapter 2 of Tomes of Delphi: Algorithms and Data Structures (DADS). Errata for Chapter 2: Arrays 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. | ||||||