home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / files / fileman / filestuf / extest40.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-09-09  |  1.0 KB  |  53 lines

  1. { EXTEST40.PAS }
  2. {
  3. Description:  Demo program to test for the existence of a file or directory,
  4.               using the Boolean function "Exists". (This version uses the
  5.               "advanced" version of Exists that requires the GetFAttr 
  6.               procedure available in the Dos Unit of Turbo Pascal 4.0.)
  7.  
  8. Author:       Don Taylor
  9. Date:         2/3/88
  10. Last revised: 02/03/88  16:45
  11. Application:  Turbo Pascal (all versions through 4.0)
  12. }
  13.  
  14.  
  15. PROGRAM TestExist;
  16.  
  17. USES
  18.  Dos;
  19.  
  20. TYPE
  21.  Str80 = STRING[80];
  22.  
  23. VAR
  24.  Fil      : FILE;
  25.  GoodName : BOOLEAN;
  26.  
  27. CONST
  28.  FileName = 'EXTEST';
  29.  
  30. {$I EXISTS40.INC }
  31.  
  32. {====================}
  33.  
  34. BEGIN { TestExist }
  35.  ASSIGN(Fil, FileName);
  36.  GoodName := TRUE;
  37.  IF FileExists(FileName)
  38.   THEN BEGIN
  39.         GoodName := FALSE;
  40.         WRITELN('File exists.')
  41.        END;
  42.  IF DirExists(FileName)
  43.   THEN BEGIN
  44.         GoodName := FALSE;
  45.         WRITELN('Directory exists.')
  46.        END;
  47.  IF GoodName
  48.   THEN BEGIN
  49.         REWRITE(Fil);
  50.         CLOSE(Fil)
  51.        END;
  52. END.  { TestExist }
  53.