Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!ukma!husc6!ogccse!blake!aragorn From: aragorn@blake.acs.washington.edu (Michael Owen) Newsgroups: comp.sys.apple Subject: Re: Catalogs Summary: Reading a ProDOS catalog via Applesoft Message-ID: <2041@blake.acs.washington.edu> Date: 16 May 89 11:05:08 GMT References: <8905151519.AA08688@crash.cts.com> Organization: Broken Blade Software Lines: 55 In article <8905151519.AA08688@crash.cts.com> pnet01!pro-nsfmat!pro-lep!j_p@nosc.mil writes: > > Is there a way to read filenames in a Prodos catalog listing from within a >Applesoft BASIC program? I've written a slide show program to display super >hires pictures from basic and would like the program to get the filenames from >the disk w/out me entering them. Thanks, > Jason There sure is. Since you can open any type of file in ProDOS with the OPEN pathname, tXXX command, reading and processing directories are a synch. Here's a sample program: 10 D$ = CHR$(4) 20 F$ = "/disk/directory": REM Enter the path of the DIR file here 30 PRINT D$"open"F$",tdir" 40 PRINT D$"read"F$ 50 INPUT I$: REM Get directory name 60 INPUT I$: REM Get column headers 70 INPUT I$: REM Get blank line 80 INPUT I$: REM Get file info 90 IF I$ = "" THEN 130: REM End of directory? 100 C = C + 1: REM Increment file counter 110 L$(C) = I$ 120 GOTO 80 130 PRINT D$"close" 140 PRINT C" file(s) read:": PRINT 150 IF NOT C THEN END 160 FOR I = 1 TO C 170 PRINT L$(I) 180 NEXT When you use this program, you're reading in the 80-column file info, formatted as follows: Column Use ------ --- 1 Locked or unlocked 2-16 Filename 18-20 Filetype 23-28 Blocks used by file 31-39 Modification date 41-45 Modification time 48-56 Creation date 58-62 Creation time 64-71 Logical end of file 73 Subtype identifier (A = load Address, R = Record length) 75-79 Load address (hex) 76-79 Record length (decimal) ______________________________________________________________________________ /> The Broken Blade Aragorn III (Michael Owen) /< ________ ______________ aragorn@blake.acs.washington.edu C=====[*>_______/|______________> Starfleet HQ: (206) 783-5589 \< 3/12/24 8N1 24 hrs - A ModemWorks BBS _______\>_____"Ai na vedui!"__________________________________________________