Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!uwvax!oddjob!gargoyle!sphinx!god3 From: god3@sphinx.uchicago.edu (Peter Godwin) Newsgroups: comp.sys.apple Subject: Re: Finding if a file exists on a disk in Applesoft BASIC. Message-ID: <1500@sphinx.uchicago.edu> Date: Mon, 20-Apr-87 17:18:20 EST Article-I.D.: sphinx.1500 Posted: Mon Apr 20 17:18:20 1987 Date-Received: Tue, 21-Apr-87 03:20:06 EST References: <8704190657.AA12796@cdfb.toronto.edu> Organization: U. of Chicago Computation Center Lines: 37 Summary: file find APPLESOFT In article <8704190657.AA12796@cdfb.toronto.edu>, a228arig@cdfb.utoronto (Tak Ariga) writes: > > 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. There are two ways I can think of doing this. One is obtaining an ampersand routine &gosub &return which will maintain the stack when an error occurs. Many utilities which make use of the ampersand vector have such a routine. This method, however, is probably not what you want. Another way to find a file on disk is to read the entire directory off of the disk with a subroutine and toss the list of files into an array. I use such a routine in a Teacher Grading program I wrote and it works well. If you (or anyone else for that matter) would like to know how this is done, I would be glad to put the routine on a disk if you send me one w/ return postage. Peter Godwin | ...ihnp4!gargoyle!sphinx!god3 Univ. of Chicago Comp Ctr | x9.xpg@uchicago 5824 S. Kimbark Ave, #2419 | god3%sphinx@uchicago Chicago, IL 60637 | Phone #: 312-288-1816 -- Peter Godwin | ...ihnp4!gargoyle!sphinx!god3 Univ. of Chicago Comp Ctr | x9.xpg@uchicago 5824 S. Kimbark Ave, #2419 | god3%sphinx@uchicago Chicago, IL 60637 | Phone #: 312-288-1816