From: pb@excelsior.xs4all.nl.REMOVE-THIS (Marc van den Dikkenberg)
Subject: Re: File existence
On Thu, 22 Jan 1998 11:48:43 -0800, Austin Bordeaux
wrote:
>I'm using PB3.00c. Can't figure a way to check for existence of a
>random access file. When attempting to open a file that doesn't exist,
>PB creates one with zero bytes without giving an error message. Not
>aware of an instruction for querying. Any ideas anybody?
Sure, and it's not very difficult:
Say, you want to check if C:\AUTOEXEC.BAT exists...
Simply use this snippet:
IF DIR$("c:\autoexec.bat")"" THEN PRINT "File exists"
All you do is see if there is a file that matches the given wildcards - the
entire filename in this case, to suit your needs.
--
Marc van den Dikkenberg
-----------------------
The PowerBasic Archives
http://www.xs4all.nl/~excel/pb.html
*** QwkNews (tm) v2.1
* [TN11.1] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)
|