Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!ames!ucbcad!ucbvax!POMONA.BITNET!MAINT From: MAINT@POMONA.BITNET Newsgroups: comp.sys.apple Subject: BITNET mail follows Message-ID: <8704222120.aa03265@SPARK.BRL.ARPA> Date: Wed, 22-Apr-87 20:00:00 EST Article-I.D.: SPARK.8704222120.aa03265 Posted: Wed Apr 22 20:00:00 1987 Date-Received: Sat, 25-Apr-87 09:51:37 EST Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 70 ========================================================================= Received: by POMONA (Mailer X1.23b) id 1348; Wed, 22 Apr 87 09:53:19 PDT Date: Wed, 22 Apr 87 09:46:43 PDT From: Network Mailer Subject: Undelivered mail To: MAINT@POMONA Your mail was not delivered to some or all of its intended recipients for the following reason(s): Transferred files not allowed(Check if it was a bad RSCS node). --------------------RETURNED MAIL FILE-------------------- Received: from BRL-SMOKE.ARPA by wiscvm.wisc.edu on 04/21/87 at 00:48:51 CDT Received: from BRL-SMOKE.ARPA by SMOKE.brl.ARPA id aa24114; 20 Apr 87 22:56 EDT Received: from BRL-SPARK.ARPA by SMOKE.BRL.ARPA id aa23986; 20 Apr 87 22:41 EDT Received: from UCBVAX.Berkeley.EDU by SPARK.BRL.ARPA id aa02355; 20 Apr 87 22:33 EDT Received: by ucbvax.Berkeley.EDU (5.57/1.23) id AA08057; Mon, 20 Apr 87 17:52:41 PST Received: from USENET by ucbvax.Berkeley.EDU with netnews for info-apple@brl.arpa (info-apple@brl.arpa) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 20 Apr 87 22:18:20 GMT From: Peter Godwin Organization: U. of Chicago Computation Center Subject: Re: Finding if a file exists on a disk in Applesoft BASIC. Message-Id: <1500@sphinx.uchicago.edu> References: <8704190657.AA12796@cdfb.toronto.edu> Sender: info-apple-request@BRL.ARPA To: info-apple@BRL.ARPA 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