Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Please Help - file exist() function Not working!!!

Author
Message
caLLow
22
Years of Service
User Offline
Joined: 10th Nov 2002
Location:
Posted: 18th Jan 2004 19:38
hi all

strage as it seems, the DarkBasic function file exist( FILE NAME ) is not trapping the error...

the code simple and from an (#include file)

has anyone encountered this?
How do I fix it?


tnx

caLLow
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 18th Jan 2004 21:05 Edited at: 18th Jan 2004 21:11
Quote: "if file exist( f$ ) = False( 0 ) then exitfunction False( 0 )"


Try instead to create a variable flag such as DoesFileExist and try to code it like.

Quote: "CODE:
DoesFileExist = file exist ( f$ )
if DoesFileExist=0 then existfunction 0 "


The reason is that the File Exist command (being a function) returns a value and it is the the help file shows it written. I think you actually want to write your code something like

Quote: "CODE:
if ( d = file exist( f$ )) = 0 then exitfunction "


But I am not sure that is good syntax.

The help file information shows
Quote: "FILE EXIST
This command will return an integer value of one if the specified file exists, otherwise zero is returned.

SYNTAX
Return Value = FILE EXIST(Filename String)
"


Wasting CPU Cycles since the 286 was a hot machine.
caLLow
22
Years of Service
User Offline
Joined: 10th Nov 2002
Location:
Posted: 19th Jan 2004 04:52
hey DBoy780,

thanks for the reply...

I'll give that a try, sounds good... just get the value returned by the function first then use that as the test to see if the file exist...

Nice

Thanks Again
Learn.Love.Teach
caLLow
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Jan 2004 12:43
Why not just write the function like this?

"eureka" - Archimedes

Login to post a reply

Server time is: 2025-05-22 14:53:01
Your offset time is: 2025-05-22 14:53:01