If FileExists as Macro
Posted: Mon Jul 01, 2013 6:33 am
I am using a request if a file exists / not exists many times in my main loop,
so I thought a Macro might be the best way to got about it, to reduce code.
(Output being 0= No, 1=Yes, 2=Error)
I am missing something and have myself stuck in an endless (for "why wont this work" loop)
FileExists(Filename$); <what I expected would work
What am I over looking here ?


so I thought a Macro might be the best way to got about it, to reduce code.
(Output being 0= No, 1=Yes, 2=Error)
I am missing something and have myself stuck in an endless (for "why wont this work" loop)
FileExists(Filename$); <what I expected would work
Code: Select all
Filename$="latest.pb"
result=FileSize(Filename$)
Select result
Case -1
Debug Filename$ +" not found"
Case -2
Debug Filename$ +" Is a directory"
Default
Debug Filename$ +" is " +result + " Bytes."
EndSelect
; This works fineCode: Select all
Filename$="latest.pb"
Macro FileExists
result=FileSize(Filename$)
Select result
Case -1
Debug Filename$ +" not found"
Case -2
Debug Filename$ +" Is a directory"
Default
Debug Filename$ +" is " +result + " Bytes."
EndSelect
EndMacro
FileExists(Filename$);
;Not working ERROR see screenshots below

