(2 of 3) DIR$ to array

 BBS: Inland Empire Archive
Date: 06-10-93 (00:48)             Number: 267
From: TIM BENNETT                  Refer#: NONE
  To: EVANS MARTIN                  Recvd: NO  
Subj: (2 of 3) DIR$ to array         Conf: (2) Quik_Bas
'>>> Start of page 2.

                inreg.si = VARPTR(PathSize)
                CALL INTERRUPTX(&H21, inreg, inreg)
                path$ = LEFT$(PathSize, INSTR(PathSize, CHR$(0))_
 - 1)
                path$ = drive$ + ":\" + path$ + "\" + wildcard$
        END IF
        'Set the area where the file information will be stored
        inreg.ax = &H1A00
        inreg.ds = VARSEG(Buffer)
        inreg.dx = VARPTR(Buffer)
        CALL Interrupt(&H21, inreg, outreg)

        'Find the first file, if FirstFM=0 then continue.
        inreg.ax = &H4E00
        inreg.cx = 62
        NPath$ = path$ + CHR$(0)
        inreg.dx = SADD(NPath$)
        CALL Interrupt(&H21, inreg, outreg)
        FirstFM = (outreg.ax AND &HF)

        'Find the next file(s), if NextFM<>0 then exit.
        IF FirstFM = 0 THEN
                GOSUB MakeFile
                DO
                        inreg.ax = &H4F00
                        inreg.dx = SADD(NPath$)
                        CALL Interrupt(&H21, inreg, outreg)
                        NextFM = outreg.ax AND &HF
                        IF NextFM = 0 THEN
                                GOSUB MakeFile
                        END IF
                LOOP WHILE NextFM = 0
        END IF
        EXIT SUB

MakeFile:
        IF LEFT$(Buffer.FileName, 1) = "." THEN
                RETURN
        END IF

        FSize$ = RIGHT$(SPACE$(8) + STR$(Buffer.FileSize), 8)

        BitT = Buffer.AccessTime
        ahr = 0
        IF BitT < 0 THEN BitT = 32767 + BitT: ahr = 16
        hr = (BitT \ 2048)
        mm = (BitT - (hr * 2048)) \ 32
        hr = ahr + hr
        FTime$ = RIGHT$("00" + LTRIM$(STR$(hr)), 2) + ":" +_
 RIGHT$("00" + LTRIM$(STR$(mm)), 2)

        BitD = Buffer.AccessDate
        yr = BitD \ 512
        mo = (BitD - (yr * 512)) \ 32
        da = BitD - (yr * 512) - (mo * 32)
        FDate$ = RIGHT$("0" + LTRIM$(STR$(mo)), 2) + "-" +_
 RIGHT$("0" + LTRIM$(STR$(da)), 2) + "-" + LTRIM$(STR$(80 + yr))

        x = INSTR(Buffer.FileName, ".")
        IF x = 0 THEN
                FileTemp$ = LEFT$(Buffer.FileName + STRING$(12,_
 32), 12)
        ELSE
                FileTemp$ = LEFT$(LEFT$(Buffer.FileName, x - 1)_
 + SPACE$(12), 8) + MID$(Buffer.FileName, x, 4)
        END IF

        IF Buffer.Attributes = 4096 AND filedir = 1 THEN
                FileTemp$ = MID$(Buffer.FileName, 1, 12)

'>>> Continued on page 3


... Everyone is entitled to my opinion.
--- GEcho/beta
 * Origin: Home - FalconWorks SoftWare - Mail Only (1:362/466.0)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET