Determines if a particular file exists.
Exist(a$)
a$ | : sexp; path name of a file |
The Exist(a$) function determines if a particular file exists in the path name specified in a$. Exist() returns -1 (True) if this file exists or 0 (False) if not. NOTE: You can not use wildcards with Exist; if you need to use wildcards, use Dir(filepath) <> "" instead
OpenW 1
Global a$, c$, a%, d%, x%
a$ = "C:\TEST.DAT"
If Exist(a$)
Open a$ for Input As # 1
Do Until EOF(# 1)
Input # 1, c$
Print c$
Loop
Close # 1
Else
Alert 1, "File not found", 1, "ok", d%
EndIf
Determines if the file TEST.DAT exists on drive C and, if it does, reads the file in.
To test for a directory you can either use DirExist (if you have the GfaWinX library loaded) or GetAttr("dir") And 16 == 16
{Created by Sjouke Hamstra; Last updated: 11/07/2023 by James Gaite}