# Re: DIRECTORY TREE

``` BBS: Inland Empire Archive
Date: 12-17-92 (20:50)             Number: 387
From: STEVE DEMO                   Refer#: NONE
To: ANDY C. OLIVER                Recvd: NO
Subj: Re: DIRECTORY TREE             Conf: (2) Quik_Bas```
``` -=> Quoting Andy C. oliver to Steve Demo <=-

ACo> You might try a Library, such as Tom Hanlin's PBCLONE.  PBCLONE17 is
ACo> the latest to date (as far as I know), and it has such routines.  As
ACo> do many other good libraries.
ACo> ACO

Hello,

I have used Pbclone before just was curious if QB could do it by it's self.
I would like to learn all about QB with out useing any libarys. But I did
get some code to do it . This was Given to me By Rick Cooper.

==========================<cut here>========================================
DECLARE FUNCTION CurrentDir\$ ()

FUNCTION CurrentDir\$
DEFSNG A-Z
DIM InRegs AS RegTypeX, OutRegs AS RegTypeX
'====================================================================
' This Function Will Return The Current Path With A Complete Path Spec
' Including Drive And Trailing "\"
' If You Don't Want The trailing "\" Then Use A Left\$ Statement To
'Remove It... E.G. Dir\$ = Left\$(CurrentDir\$,Len(CurrentDir\$) - 1)
'===================================================================

InRegs.ax = &H1900                         'Use Dos Function To Get
CALL INTERRUPTX(&H21, InRegs, OutRegs)     'Current Drive
drive% = (OutRegs.ax AND &HFF) + 1         'Function Returns 0 Based
'Drive Number And Next
'Function needs A 1 Based
'Number So We Add 1 To Result

drive\$ = CHR\$(64 + drive%)                 'Create String Representation
'In Uppercase, Of Current
'Drive Number

DIRECTORY\$ = SPACE\$(64)                    'Create Scratch Buffer

InRegs.ax = (256 * &H47) + 0               'Load Function Number
InRegs.dx = (256 * 0) + drive%             'Load Drive Number
InRegs.ds = VARSEG(DIRECTORY\$)             'Pointer To A 64 Byte
CALL INTERRUPTX(&H21, InRegs, OutRegs)     'Call Dos Int. 21 Func. 47

spot = INSTR(DIRECTORY\$, CHR\$(0))          'Function Returns An ASCIIZ
IF spot <> 0 THEN                          'String And We Don't Want The
DIRECTORY\$ = LEFT\$(DIRECTORY\$, spot - 1) 'Terminating Null Character
END IF                                     'So This Removes It And
'Trailing Spaces

IF LEN(DIRECTORY\$) > 1 THEN                'If It Isn't The Root Then

CurrentDir\$ = drive\$ + ":\" + DIRECTORY\$ + "\"

ELSE                                       'If It Is The Root We Don't
CurrentDir\$ = drive\$ + ":\" + RTRIM\$(LTRIM\$(DIRECTORY\$))
END IF                                     'Done!

END FUNCTION

========================<cut here>==========================================

Just thought I would share what was given to me.

Take it easy,

Steve Demo

... Pardon Me, But Would You Have Any Blue Poupon?
--- Blue Wave/QBBS v2.11 [NR]
* Origin: Just For The Heck Of It II   -=(Fort Wayne In)=- (1:236/16.0)
```

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