[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help Me!! Getting CATALOG into an Array Variable



In article <jonINTERNETrelayCHAT-2602000003390001@nn-157-22-180-164.napanet.net>,
Jon Bettencourt <jonINTERNETrelayCHAT@napaVALLEYnet.CLARInet> wrote:
>I'm trying to get the CATALOG of the current ProDOS directory into an
>array in Applesoft.

One of the nice things about ProDOS BASIC.SYSTEM (compared to DOS 3.3) is
that you can open a directory more or less like you'd open a text file. 
This simple program will read in a selected directory and spit out just the
filenames to the screen; fixing it to dump the names into an array would be
trivial.

10 D$=CHR$(4):INPUT "Pathname? ";P$
20 PRINT D$;"OPEN ";P$;",TDIR":PRINT D$;"READ ";P$:INPUT G$:INPUT G$:INPUT G$
30 INPUT I$:IF I$<>"" THEN PRINT MID$(I$,2,15):GOTO 30
40 PRINT D$;"CLOSE ";P$

Note that you could extract more than just the filenames from a
directory...you could get the size, filetype, created/modified dates, and
all the other information that the CATALOG command gives you (the info is in
the same format...skip the first three lines of input and stop when you get
an empty line).

  _/_
 / v \
(IIGS(  Scott Alfter (salfter at (yo no quiero spam) delphi dot com)
 \_^_/  http://salfter.dyndns.org