Path: utzoo!attcan!uunet!lll-winken!ames!xanth!mcnc!rti!sunpix!matthew From: matthew@sunpix.UUCP ( Sun NCAA) Newsgroups: comp.sys.apple Subject: Re: Getting a CATALOG into a file Keywords: CATALOG Message-ID: <376@greens.UUCP> Date: 26 Jan 89 18:20:30 GMT References: <410f8301.14dd6@c> Organization: Sun Microsystems, Research Triangle Park, NC Lines: 58 In article <410f8301.14dd6@c>, bauer@procase.UUCP (Jerry Bauer) writes: # # # Alright, class, today's question is: # # Under ProDOS, in APPLESOFT, how can one get a list of the files on # a given disk (CATALOG) into a file? # # # This code DOESN'T work: # # 100 PRINT CHR$(4);"OPEN TEMP.CATALOG" # 110 PRINT CHR$(4);"WRITE TEMP.CATALOG" # 120 CATALOG # 130 PRINT CHR$(4);"CLOSE TEMP.CATALOG" # # because line 120 becomes: # # 120 C AT A LOG # # # (Isn't APPLESOFT wonderful?) # # # I suspect that answers to this question are of general interest; # but if you disagree, just send them to me # # JRBauer (Jerry) ...!tolerant!procase!bauer # ...!hpda!procase!bauer # ...!cae780!procase!bauer # Your first mistake is to try and execute a BASIC.SYSTEM command from within a running program with PRINTING it like you did in lines 100, 110 and 130. Secondly, I don't think your snippit of code would work as desired, even if you did correct it. Now mind you, I haven't tried this yet, but I think you need to do the following (written in pseudo code) "OPEN /DISKNAME" REM open file using directory name "OPEN TEMP.CATALOG" REM open text file to put the retrieved CAT ONERROR GOTO ENDRD REM set ONERROR to trap end of file RDLOOP "READ /DISKNAME" REM set input to directory name READ A$ REM and get a line it "WRITE TEMP.CATALOG" REM set output to file PRINT A$ REM and send a line to it GOTO RDLOOP REM keep doing it until done ENDRD "CLOSE" REM close all open files I used a error detection to trap the end of file in this example. But you could also try testing for a string in the last line of the catalog, and exit the loop before getting the end of file error. -- Matthew Lee Stier (919) 469-8300| Sun Microsystems --- RTP, NC 27560| "Wisconsin Escapee" uucp: {sun, rti}!sunpix!matthew |