Search found 3 matches
- Mon May 04, 2015 11:14 am
- Forum: QBASIC and QB64 Questions & Answers
- Topic: How to check if a file exist? Newbie
- Replies: 4
- Views: 11188
Re: How to check if a file exist? Newbie
Thanks for the assistance. I did have to add another CLOSE #F% FUNCTION EXIST% (FILENAME$) F% = FREEFILE OPEN FILENAME$ FOR APPEND AS #F% IF LOF(F%) THEN EXIST% = -1 CLOSE #F% ' without this I got 'File already Open' if the file did exist. ELSE EXIST% = 0 CLOSE #F% KILL FILENAME$ CLOSE #F% END IF EN...
- Wed Apr 29, 2015 8:23 am
- Forum: QBASIC and QB64 Questions & Answers
- Topic: How to check if a file exist? Newbie
- Replies: 4
- Views: 11188
Re: How to check if a file exist? Newbie
Thanks for the reply. Looks like it is time to lean about Functions, I will give it a go.
- Sat Apr 25, 2015 11:11 am
- Forum: QBASIC and QB64 Questions & Answers
- Topic: How to check if a file exist? Newbie
- Replies: 4
- Views: 11188
How to check if a file exist? Newbie
I want to delete a file if it already exists. There will be occasions when it does not exist. Is there a neat way of doing this. I propose to use the KILL command to delete the file(s) and if a 'File not Found' error is returned use the ON ERROR RESUME NEXT to move on to the next command/function. T...