=========================================================================== BBS: The Abacus * HST/DS * Potterville, MI Date: 03-16-93 (05:04) Number: 253 From: TIM FITZGERALD Refer#: 369 To: EARL MONTGOMERY Recvd: NO Subj: Change Directory Conf: (35) Quick Basi --------------------------------------------------------------------------- EM>function 3B but I guess I don't know enough about interrupts as EM>it always locks my computer up! . Could someone please post EM>code showing how to change directories using interrupts. Here you go Earl.. hopefully you can get some use out of it. *------------------------------------------------------------------- ' QBCD.BAS ' $INCLUDE: 'QB.BI' DECLARE SUB QB.cd (NewSub$) DECLARE FUNCTION QB.getdir$ () DIM SHARED InRegs AS RegType, OutRegs AS RegType DIM SHARED InRegsX AS RegTypeX, OutRegsX AS RegTypeX CLS ' Here's a simple routine to demonstrate QB.cd ' and QB.getdir$. ' Drive changing is NOT supported. However, you ' can pass the drive letter along with the ' desired path. DO COLOR 14, 0 PRINT "[" + QB.getdir$ + "] "; ' The maximum length for NewDir$ can only be 64 chars ' DRIVE & PATH can be given. COLOR 7, 0 LINE INPUT "CD: ", NewDir$ IF (NewDir$ > "") THEN QB.cd NewDir$ END IF LOOP UNTIL (NewDir$ = "") END SUB QB.cd (NewSub$) ' Function 3BH, under Interrupt 21H expects an ASCIIZ string ' so we will add a NULL now. NewSub$ = NewSub$ + CHR$(0) ' Load the required registers ' ds:dx is the address of the ASCIIZ string InRegsX.ax = &H3B00 InRegsX.ds = VARSEG(NewSub$) InRegsX.dx = SADD(NewSub$) ' Call the Interrupt INTERRUPTX &H21, InRegsX, OutRegsX ' Note, InRegsX.flags returns: ' 0 = Successful ' 1 = Error END SUB FUNCTION QB.getdir$ ' The following three lines are used to ' get the current drive. InRegs.ax = &H1900 INTERRUPT &H21, InRegs, OutRegs Drive$ = CHR$((OutRegs.ax AND 255) + ASC("A")) + ":\" ' The following sets up Function 47H (INT 21H) so ' it can return the current directory. TempDir$ = STRING$(64, " ") InRegsX.ax = &H4700 InRegsX.dx = 0 InRegsX.ds = VARSEG(TempDir$) InRegsX.si = SADD(TempDir$) CALL INTERRUPTX(&H21, InRegsX, OutRegsX) ' Here we just add the drive letter to the directory TempDir$ = LEFT$(TempDir$, INSTR(TempDir$, CHR$(0)) - 1) ' Return the current drive:path QB.getdir$ = Drive$ + TempDir$ END FUNCTION *------------------------------------------------------------------- Enjoy! Later, Tim ___ X OLX 2.1 TD X Press "+" to see another tagline. --- Maximus 2.01wb * Origin: The Chatter Box [SDN] [v32b/v42b] (504)775-7825 (1:3800/18) SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1 SEEN-BY: 153/752 154/40 77 157/2 159/100 125 430 950 203/23 209/209 280/1 SEEN-BY: 390/1 396/1 15 397/2 2230/100 3603/20