Ok, I got a question - trying to get a handle on this brain-teaser. Take the following code:
break on
$nul = FileExists ("blah-blah")
@ERROR
exit 1
function FileExists($filename)
$FileExists = exist($filename)
if $FileExists
exit 0
else
exit 2
endif
endfunction
If I run this, I get the following on my console:
2
Makes sense because I silenced the UDF. But, if I un-silence the UDF, like this:
FileExists ("blah-blah")
and let the code go to the screen, I get this as output:
00 (two zeros)
Something's amiss with the exit(n) code under certain circumstances. Can't quite get my head around it.
-Shawn
well, this version works ok:
function FileExists($filename)
if exist($filename)
$FileExists = 1
exit 0
else
$FileExists = 0
exit 2
endif
endfunction
so i guess its something to do with that one-liner, and it seems to be specific to the exist()function ?
$FileExists = exist($filename)
--Shawn
[ 07 May 2002, 06:38: Message edited by: Shawn ]