A.2. Чтение ppu-файлов

Вверх  Предыдущий  Следующий

Сначала мы создаём объект ppufile, который будет использоваться ниже. Мы открываем модуль test.ppu в качестве примера.

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.openfile then
  error('error opening unit test.ppu');
{ here we can read the unit }
{ close unit }
  ppufile.closefile;
{ release object }
  dispose(ppufile,done);
end;

ПРИМЕЧАНИЕ

Если функция завершилась ошибкой (например, в записи осталось недостаточно байт), она устанавливает переменную ppufile.error.