home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!mcsun!news.funet.fi!uwasa.fi!ts
- From: ts@uwasa.fi (Timo Salmi)
- Subject: Is it a directory (in Turbo Pascal)
- Message-ID: <1992Nov7.131109.29456@uwasa.fi>
- Organization: University of Vaasa, Finland
- Date: Sat, 7 Nov 1992 13:11:09 GMT
- Lines: 55
-
- This is in particular to Richard Breuer (whose email bounces) but
- also to the other users.
-
- Ricki, I have been looking at your problem of establishing whether a
- directory exists or not. Try if this works on your DrDos 6.0
- environment.
-
- (* This function returns whether a name is a directory or not.
- Avoid using this on an open file or standard devices.
- By Prof. Timo Salmi, University of Vaasa, Finland *)
- function ISDIRFN (name : string) : boolean;
- var stash : byte;
- flep : file;
- begin
- stash := FileMode;
- FileMode := 0;
- assign (flep, name);
- {$I-} reset (flep); {$I+}
- if IOResult = 0 then
- begin
- {$I-} close (flep); {$I+}
- isdirfn := false;
- end
- else
- begin
- assign (flep, name+'NUL');
- {$I-} reset (flep); {$I+}
- if IOResult = 0 then
- begin
- {$I-} close (flep); {$I+}
- isdirfn := true;
- end
- else
- begin
- assign (flep, name+'\NUL');
- {$I-} reset (flep); {$I+}
- if IOResult = 0 then
- begin
- {$I-} close (flep); {$I+}
- isdirfn := true;
- end
- else
- isdirfn := false;
- end;
- end;
- FileMode := stash;
- end; (* isdirfn *)
-
- All the best, Timo
-
- ..................................................................
- Prof. Timo Salmi
- Moderating at garbo.uwasa.fi anonymous FTP archives 128.214.87.1
- Faculty of Accounting & Industrial Management; University of Vaasa
- Internet: ts@uwasa.fi Bitnet: salmi@finfun ; SF-65101, Finland
-