FileExists with or without #include file.bi. Which is it?

New to FreeBASIC? Post your questions here.
Post Reply
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

FileExists with or without #include file.bi. Which is it?

Post by Flyzone »

What would cause the following circumstance during a compile of my program with use of the "FileExists" function?

I am using FBlde and FBC 1.07.1 with "fblite"

At first, the program and FileExists function worked just fine, but I did not have an "#include file.bi" statement in the program. Worked anyway. Then, after a few uses and compiles, the function stops working and I get an undeclared variable error. I went crazy for awhile then saw the doc ref to use the #include file.bi which I then inserted and lo and behold, it worked.

I had another program open (in FBlde) but that didn't have any include statement or use of the FileExists function.

This behavior just seems inconsistent to me and I'm not a fan of magic.

Here's the program (shortened after several attempts to get it working) which originally did not have the include file.bi stmt.

#include "file.bi"
dim as string filename
filename="xxxxxx.txt"
if FileExists("xxxxxx.txt") then Print "yes"
If FileExists( filename ) Then Print "yup"
Post Reply