next up previous contents
Next: The Header Up: Anatomy of a unit Previous: Basics

reading ppufiles

We will first create an object ppufile which will be used below. We are opening unit test.ppu as an example.

var
  ppufile : pppufile;
begin
{ Initialize object }
  ppufile:=new(pppufile,init('test.ppu');
{ open the unit and read the header, returns false when it fails }
  if not ppufile.open then
    error('error opening unit test.ppu');

{ here we can read the unit }

{ close unit }
  ppufile.close;
{ release object }
  dispose(ppufile,done);
end;

Note: When a function fails (for example not enough bytes left in an entry) it sets the ppufile.error variable.



Michael Van Canneyt
Thu Sep 10 14:04:11 CEST 1998