home *** CD-ROM | disk | FTP | other *** search
- { EXTEST40.PAS }
- {
- Description: Demo program to test for the existence of a file or directory,
- using the Boolean function "Exists". (This version uses the
- "advanced" version of Exists that requires the GetFAttr
- procedure available in the Dos Unit of Turbo Pascal 4.0.)
-
- Author: Don Taylor
- Date: 2/3/88
- Last revised: 02/03/88 16:45
- Application: Turbo Pascal (all versions through 4.0)
- }
-
-
- PROGRAM TestExist;
-
- USES
- Dos;
-
- TYPE
- Str80 = STRING[80];
-
- VAR
- Fil : FILE;
- GoodName : BOOLEAN;
-
- CONST
- FileName = 'EXTEST';
-
- {$I EXISTS40.INC }
-
- {====================}
-
- BEGIN { TestExist }
- ASSIGN(Fil, FileName);
- GoodName := TRUE;
- IF FileExists(FileName)
- THEN BEGIN
- GoodName := FALSE;
- WRITELN('File exists.')
- END;
- IF DirExists(FileName)
- THEN BEGIN
- GoodName := FALSE;
- WRITELN('Directory exists.')
- END;
- IF GoodName
- THEN BEGIN
- REWRITE(Fil);
- CLOSE(Fil)
- END;
- END. { TestExist }