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.
|
Forum Index : Microcontroller and PC projects : OPTION ERROR CONTINUE gone from 5.4 DOS.
Author | Message | ||||
Paul_L Guru Joined: 03/03/2016 Location: United StatesPosts: 769 |
The OPTION ERROR [CONTINUE | ABORT] commands, which were used to check for file i/o errors, are not in the DOS V 5.4 documentation. Instead I find ON ERROR [ABORT | IGNORE | SKIP [nn] | CLEAR]. I was going to use this generic FIO%() function to open all my files but I'm not sure how to use the new error checking commands. Help please. Paul in NY ' in the mainline I use this statement to open any file if FIO%(FIlblN$,FIlblB%,"R")=0 then CRAsh*t("UBLEWIT! Can't open file "+FIlblN$) ' then I do something with the file FUNCTION FIO%(fn$,bf%,rwa$) '^1=open, 0=fail, where rwa$= [R|W|A] OPTION ERROR CONTINUE SELECT CASE rwa$ CASE "R" OPEN fn$ for input as #bf% CASE "W" OPEN fn$ for output as #bf% CASE "A" OPEN fn$ for append as #bf% END SELECT if MM.ERRNO <> 0 then FIO%=0 else FIO%=1 OPTION ERROR ABORT END FUNCTION 'FIO%(fn$,bf%,rwa$) SUB CRAsh*t(st$) ' close all open files and crash LOCAL i% OPTION ERROR CONTINUE for i%=1 to 10:close #i%:next i% OPTION ERROR ABORT ERROR st$ ' crash the program END SUB 'CRAsh*t(st$) ' close all open files and crash |
||||
Paul_L Guru Joined: 03/03/2016 Location: United StatesPosts: 769 |
Hey, look at that!! The web site doesn't like the vernacular term referring to the ubiquitous product of defecation. It cleaned up my procedure name. In the future I'll substitute CRASHtheWHOLEdarnedTHING(st$) for my usual CRASH_IT(st$). Paul in NY |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
This should work (not tested): ' in the mainline I use this statement to open any file if FIO%(FIlblN$,FIlblB%,"R")=0 then CRAsh*t("UBLEWIT! Can't open file "+FIlblN$) ' then I do something with the file FUNCTION FIO%(fn$,bf%,rwa$) '^1=open, 0=fail, where rwa$= [R|W|A] ON ERROR IGNORE SELECT CASE rwa$ CASE "R" OPEN fn$ for input as #bf% CASE "W" OPEN fn$ for output as #bf% CASE "A" OPEN fn$ for append as #bf% END SELECT if MM.ERRNO <> 0 then FIO%=0 else FIO%=1 ON ERROR ABORT END FUNCTION 'FIO%(fn$,bf%,rwa$) SUB CRAsh*t(st$) ' close all open files and crash LOCAL i% ON ERROR IGNORE for i%=1 to 10:close #i%:next i% ON ERROR ABORT ERROR st$ ' crash the program END SUB 'CRAsh*t(st$) ' close all open files and crash Geoff Graham - http://geoffg.net |
||||
Paul_L Guru Joined: 03/03/2016 Location: United StatesPosts: 769 |
Thanks Geoff, I kind of figured that was what you intended. BTW, in several places in the various manuals you use the variable name STR for an array sort of like this: DIM AS STRING str (5, 10) LENGTH 20 This looks funny as heck. I figured that str would be a reserved word. Will it conflict with the function str$()? Is the space allowed between the variable name and its array dimension brackets? Paul in NY |
||||
CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 1986 |
this was touched on in this thread |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
Thanks, yes that is a poor choice of a variable name. I will change it forthwith. Geoff Geoff Graham - http://geoffg.net |
||||
Print this page |