pebe
New Member
Posts: 2
|
Post by pebe on Apr 28, 2002 15:00:03 GMT -5
Hello Brisray,
I saw in your tutorial a method of checking to see if a file exists, using ON ERR.
Thought you might like to see what I use:-
SUB check4file(a%) OPEN (filename) FOR APPEND AS #1 IF LOF(1)=0 THEN a%=0 ELSE a%=1 IF a%=0 THEN KILL (filename) END SUB
|
|
|
Post by brisray on Apr 30, 2002 15:23:52 GMT -5
That's pretty neat and blindingly obvious.
I'll keep a copy of that and pass it off as my own code when I think it's safe.
Actually, it's going on my QBasic pages and properly attributed to you.
Thanks
Ray
|
|
pebe
New Member
Posts: 2
|
Post by pebe on May 4, 2002 13:00:49 GMT -5
I did the code from memory, rather than pasting it. So a couple of errors crept in. Here it is - corrected.
SUB check4file(filename,a%) OPEN (filename) FOR APPEND AS #1 IF LOF(1)=0 THEN a%=0 ELSE a%=1 CLOSE filename IF a%=0 THEN KILL (filename) END SUB
|
|
|
Post by brisray on May 6, 2002 12:53:27 GMT -5
Thanks Pebe, the code now appears on the Files and Errors pages.
Ray
|
|