Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
marcwolf Senior Member Joined: 08/06/2009 Location: AustraliaPosts: 119
Posted: 06:26pm 21 Jan 2013
Copy link to clipboard
Print this post
Hi Folks
If I try and read in from a file number that has not been used I get an error. Is there a way I can check this situation and not crash out of the program.
DaveEdited by marcwolf 2013-01-23Coding Coding Coding..
Keep those keyboards coding..
RAW CODE!!!!!
shoebuckle Senior Member Joined: 21/01/2012 Location: AustraliaPosts: 189
Posted: 08:28pm 21 Jan 2013
Copy link to clipboard
Print this post
I gather that the non-existence of the file is a valid condition, so how about testing that the file exists before trying to read from it and set a flag to say that it exists or doesn't. This will work because OPTION ERROR CONTINUE will trap a non-existent file.
OPTION ERROR CONTINUE
File1=1
OPEN "MyDataFile" FOR INPUT AS #1
IF MM.ERRNO = 6 THEN File1 = 0
OPTION ERROR ABORT
...
...
If File1 = 1 THEN INPUT #1, a,b,c