home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / files / fileman / filestuf / exists40.inc < prev    next >
Encoding:
Text File  |  1988-09-09  |  1008 b   |  42 lines

  1. { EXISTS40.INC }
  2. {
  3. Description:  Advanced functions to test for the existence of a specified
  4.               file or directory. Detects the presence of the file or dir-
  5.               ectory, even if it is marked as read-only or it is a hidden
  6.               or system entity.
  7.  
  8. Author:       Don Taylor
  9. Date:         12/17/87
  10. Last revised: 04/18/88 8:45 (Made corrections per "TUG's Bugs", Issue 24)
  11. Application:  IBM PC or compatible with Turbo Pascal 4.0
  12. }
  13.  
  14.  
  15. FUNCTION FileExists(FName : Str80) : BOOLEAN;
  16.  
  17. VAR
  18.  f     : FILE;
  19.  fAttr : WORD;
  20.  
  21. BEGIN
  22.  ASSIGN(f, FName);
  23.  GetFAttr(f, fAttr);
  24.  FileExists := (DosError = 0)
  25.                 AND ((fAttr AND Directory) = 0)
  26.                 AND ((fAttr AND VolumeID)  = 0)
  27. END;  { FileExists }
  28.  
  29. {--------------------}
  30.  
  31. FUNCTION DirExists(DName : Str80) : BOOLEAN;
  32.  
  33. VAR
  34.  f     : FILE;
  35.  fAttr : WORD;
  36.  
  37. BEGIN
  38.  ASSIGN(f, DName);
  39.  GetFAttr(f, fAttr);
  40.  DirExists := ((fAttr AND Directory) <> 0) AND (DosError = 0)
  41. END;  { DirExists }
  42.