Solved Find if file exists in QuickBASIC

June 19, 2010 at 19:20:35
Specs: MS-DOS
Hi, I need to know how to get QuickBASIC to find a specific file, and let's say, retort back if it exists or not.
Kinda like this, let's say for argument's sake it's a function

If FileExist(file.dat) THEN PRINT "File Found"
If NoFileExist(File.dat) THEN PRINT "File NOT Found"

it doesn't have to act as a function, I'm quite flexible about this.

See More: Find if file exists in QuickBASIC

June 19, 2010 at 20:08:22
✔ Best Answer
Ha! i was looking for the same thing today.
easiest way is like this:

print "file "+xx"+" ";
on error goto nofile
open xx for input as #1
goto filexists
print " not found..."
resume xit
close #1
print "exists, ok!"
'do whatever at this point...
on error goto 0
'----- end
it's funky and awkward, but even vb doesn't seem to have
the "if exist" functionality. Just always remember to set
ON ERROR back to zero! that has KILLED me a thousand times trying to figure out wny i was getting weird results.

Report •

June 19, 2010 at 20:14:21
Ok, I'm trying this, I will rate if It works

Report •

June 19, 2010 at 20:17:51

I THINK it works now.

Report •

Related Solutions

June 19, 2010 at 20:21:39
Yes, Thank you nbrane! After changing xx to x$ it worked perfectly!

Report •

Ask Question