Posted: 03:47pm 27 Feb 2014 |
Copy link to clipboard |
Print this post |
|
What the flippin' heck am I doing wrong here?
DATABASE:
timer=0:FlagSD=1
Open F$ For input As #3:T=timer
If MM.Errno<>0 Then
if MM.ERRNO=5 or mm.errno=6 then exit
else
goto errors
endif
Line Input #3,N$:Line Input #3,L$:Line Input #3,A$
Close #3:FlagSD=0
return
Simple GOSUB routine, which opens F$ to read a file.
I keep getting the error "File number is not open" with the LINE INPUT line of the code, but when I check mm.errno it is zero, so it seems that it was able to find and open the file, then says it can't read from it, cos the port is not open when it is.
There must be something I am doing wrong, but I cannot see where my bug is.
The file and directory don't actually exist - I am testing the error-trapping. In my screenshot, you can see if I manually open the port, mm.errno=5, as expected, as the file and folder can't be found, but at that point, the code should be in the IF/THEN loop, and should EXIT from the gosub, not keep going at this point - it should never get to the LINE INPUT line of code, in other words.Edited by Grogster 2014-03-01 Smoke makes things work. When the smoke gets out, it stops! |