ex51.pp 359 B

1234567891011121314151617181920212223
  1. Program Example51;
  2. { Program to demonstrate the Reset function. }
  3. Function FileExists (Name : String) : boolean;
  4. Var F : File;
  5. begin
  6. {$i-}
  7. Assign (F,Name);
  8. Reset (F);
  9. {$I+}
  10. FileExists:=(IoResult=0) and (Name<>'');
  11. Close (f);
  12. end;
  13. begin
  14. If FileExists (Paramstr(1)) then
  15. Writeln ('File found')
  16. else
  17. Writeln ('File NOT found');
  18. end.