Re: DISK SIZE

 BBS: Inland Empire Archive
Date: 01-16-93 (01:08)             Number: 375
From: ROB MCKEE                    Refer#: NONE
  To: KEITH WATKINS                 Recvd: NO  
Subj: Re: DISK SIZE                  Conf: (2) Quik_Bas
Hi Keith
 KW> Someone had posted code to not only see how much room was left on a disk
 KW> but how big the disk room was in total.

 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
 END TYPE
 DIM Reg AS RegTypeX, Breg AS RegTypeX, Regx AS RegType, BregX AS RegType
 cmd$ = COMMAND$

 Reg = Breg ' I do this as a fast way of Zeroing the Type Variable.
 Reg.ax = &H3600
 Reg.Dx = 0 ' 0 Default Drive, 1 for A:, 2 for B:, 3 . . .
 CALL INTERRUPT(&H21, Reg, Reg)
 TotCl& = Int2Long&(Reg.Dx)
 AvaCl& = Int2Long&(Reg.Bx)
 SecCl& = Int2Long&(Reg.ax)
 SecSz& = Int2Long&(Reg.Cx)
 CluSz& = SecCl& * SecSz&
 Free& = AvaCl& * CluSz&
 Total& = TotCl& * CluSz&
 Used& = Total& - Free&

 FUNCTION Int2Long& (TheInt%)
  IF TheInt% < 0 THEN Int2Long& = TheInt% + 65536 ELSE Int2Long& = TheInt%
 END FUNCTION

                      TTYL - Rob McKee
       Ya know....   I can't Spell!

--- *Msg V4.5
 * Origin: Flyer Proof Computer Services V# 1-510-237-8091 (1:125/1212.13)
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