BBS: Inland Empire Archive Date: 05-30-92 (23:51) Number: 146 From: MATT HART Refer#: NONE To: JASON SHARPEE Recvd: NO Subj: QUICK BASIC DIR ROUTINE Conf: (2) Quik_Bas
' ' SRCHFILE.BAS by Matt Hart ' Uses Interrupt 21H to find a file matching a specification. ' Use SrchNext for the next matching file. ' DEFINT A-Z TYPE RegTypeX ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER ds AS INTEGER es AS INTEGER END TYPE TYPE DTAType A as string * 42 END TYPE DIM DTA as DTAType ' ---------------- Sample Code Srch$="*.BAS" CALL SrchFile (Srch$,File$,DTA,Ecode) Print File$;Ecode ' Ecode may return: ' 2 = path invalid ' 18 = match not found END ' ---------------------------- SUB SrchFile (Srch$,File$,DTA as DTAType,Ecode) DIM InRegs as RegTypeX DIM OutRegs as RegTypeX DIM F as string * 64 InRegs.AX = &H1A00 InRegs.DS = VARSEG(DTA) InRegs.DX = VARPTR(DTA) CALL InterruptX (&H21, InRegs, OutRegs) F = Srch$+CHR$(0) InRegs.AX = &H4E00 InRegs.CX = 0 InRegs.DS = VARSEG(F) InRegs.DX = VARPTR(F) CALL InterruptX (&H21, InRegs, OutRegs) File$ = MID$( DTA.A,31 ) File$ = LEFT$(File$, INSTR(File$+CHR$(0),CHR$(0))-1) Ecode = OutRegs.AX END SUB Continued... --- * Origin: Midnight Micro! V.32/REL (918)451-3306 (1:170/600)
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