BBS: Inland Empire Archive Date: 01-08-93 (13:51) Number: 391 From: RON SHARRAD Refer#: NONE To: MARK WITTKOSKI Recvd: NO Subj: Disk Space Conf: (2) Quik_Bas
On 12-28-92 12:56, Mark Wittkoski wrote to All about Disk Space...
MW> How can I find out much space I have on an available disk. This is
MW> quite critical to a program I am writing and need to know!
I can't remember who I originally got this from but I just modified
it a bit. Thanks to the unknown author!
Load QB with /l switch to load InterruptX routine.
==========================CUT=====================
' * FUNCTION DriveSpc&. Returns available space on specified or
' default drive, or -1 if drive full.
' * Usage e.g. Drv$ = "A"
' or Drv$ = "A:"
' or Drv$ = "a:"
' or Drv$ = "" 'for current drive.
' * FreeSpace% = DriveSpc&(Drv$)
'$INCLUDE: 'QB.BI' ' * or QBX.BI
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
DECLARE FUNCTION DriveSpc& (Drive$)
FUNCTION DriveSpc& (Drive$)
DIM InReg AS RegTypeX
DIM OutReg AS RegTypeX
InReg.AX = &H3600
IF Drive$ = "" THEN
InReg.DX = 0
ELSE
InReg.DX = ASC(Drive$) AND &H1F
END IF
CALL InterruptX (&H21, InReg, OutReg)
Sectors& = OutReg.AX AND 65535
IF Sectors& = 65535 THEN
DriveSpc& = -1
ELSE
Clusters& = OutReg.BX AND 65535
Bytes& = OutReg.CX AND 65535
DriveSpc& = Bytes& * Sectors& * Clusters&
END IF
END FUNCTION
==========================CUT=====================
Good Luck!...
<:-) Ron Sharrad (-:>
*=-----------=*
___ Blue Wave/QWK v2.12
--- Maximus 2.01wb
* Origin: Biz-Nice! S.Oz Business BBS! 4 Lines 08-269 7029/7809 (3:800/851)

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