Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!husc4!nakada From: nakada@husc4.HARVARD.EDU (paul nakada) Newsgroups: comp.sys.apple Subject: Re: Finding if a file exists on a disk in Applesoft BASIC. Message-ID: <1701@husc6.UUCP> Date: Mon, 20-Apr-87 21:21:49 EST Article-I.D.: husc6.1701 Posted: Mon Apr 20 21:21:49 1987 Date-Received: Tue, 21-Apr-87 05:51:18 EST References: <8704190657.AA12796@cdfb.toronto.edu> <1500@sphinx.uchicago.edu> Sender: news@husc6.UUCP Reply-To: nakada@husc4.UUCP (paul nakada) Organization: Harvard Univ. Science Center Lines: 23 >> Can anyone inform me how I can find out if a given file exists on the >> disk or not through a BASIC (or a ML routine) program? >> >> Right now, I am using VERIFY to see if the file name exists. If it doesn't >> exists (the desired case), it causes an error. I use ONERR GOTO and use >> an error handling routine to deal with it. The problem is, it seems to >> clear some GOSUB stacks, and when it encounters a RETURN, it comes back >> with 'RETURN WITHOUT GOSUB ERROR', even though it was within a subroutine. This problem is easily overcome using basic. The key to it is understanding the error handling in the apple. The ONERR GOTO statement is not a conditional gosub statement. It does, although save the current program location. After the proper error correcting statements are executed in the error routine (in this case, the creation of a file) a RESUME command should be executed and not a RETURN. This will return to the point of the error where the error has been corrected. Hope this helps... paul nakada nakada@husc4.harvard.edu nakada@harvsc4.BITNET