Task

Verify that a file called     input.txt     and   a directory called     docs     exist.



This should be done twice:  

   once for the current working directory,   and
   once for a file and a directory in the filesystem root.


Optional criteria (May 2015):   verify it works with:

   zero-length files
   an unusual filename:     `Abdu'l-Bahá.txt  


100 F$ = "THAT FILE"
110 T$(0) = "DOES NOT EXIST."
120 T$(1) = "EXISTS."
130 GOSUB 200"FILE EXISTS?
140 PRINT F$; " "; T$(E)
150 END
 
200 REM FILE EXISTS?
210 REM TRY
220    ON ERR GOTO 300"CATCH
230    PRINT CHR$(4); "VERIFY "; F$
240    POKE 216, 0 : REM ONERR OFF
250    E = 1
260    GOTO 350"END TRY
300 REM CATCH
310    E = PEEK(222) <> 6
320    POKE 216, 0 : REM ONERR OFF
330    IF E THEN RESUME : REM THROW
340    CALL  - 3288 : REM RECOVER
350 REM END TRY
360 RETURN
 