RosettaCodeData/Task/Check-that-file-exists/BASIC/check-that-file-exists-1.basic
2023-07-01 13:44:08 -04:00

28 lines
462 B
Text

ON ERROR GOTO ohNo
f$ = "input.txt"
GOSUB opener
f$ = "\input.txt"
GOSUB opener
'can't directly check for directories,
'but can check for the NUL device in the desired dir
f$ = "docs\nul"
GOSUB opener
f$ = "\docs\nul"
GOSUB opener
END
opener:
e$ = " found"
OPEN f$ FOR INPUT AS 1
PRINT f$; e$
CLOSE
RETURN
ohNo:
IF (53 = ERR) OR (76 = ERR) THEN
e$ = " not" + e$
ELSE
e$ = "Unknown error"
END IF
RESUME NEXT