Quote:
be careful when using FreeFileHandle() - don't get caught out by this schoolboy error:
Code:
$fhLogFile=FreeFileHandle()
$fhOutFile=FreeFileHandle()
; Open log file...
If Open($fhLogFile,"c:\temp\log.txt",5) "CANNOT OPEN LOG FILE"+@CRLF Exit @ERROR EndIf
; Open out file...
If Open($fhOutFile,"c:\temp\out.txt",5) "CANNOT OPEN OUT FILE"+@CRLF Exit @ERROR EndIf
Though perhaps not as obvious to some it would not work as Richard wrote it.
BOTH files would have a FreeFile number of 1 which would then cause an error.
$fhLogFile=FreeFileHandle()
$fhOutFile=FreeFileHandle()
Since the call is one right after the other without actually opening any file, they
will both end up having the same value for their var.
I would probably close the files in each of the IF blocks, but as in this example it could be closed at the end if you like..