BBS: Inland Empire Archive Date: 01-07-93 (07:50) Number: 346 From: FRANCOIS ROY Refer#: NONE To: STEVE PERRY Recvd: NO Subj: Re: disk size detection Conf: (2) Quik_Bas
SP> Does anyone have an easy way to detect whether the disk in the drive is SP> a low density or if it's a high density? There has been code floating around to give you free space left on a disk. The same function call returns total disk space available. Simply test that value to see if it is greater than, say, 800000. If it is, it's a high-density 5.25in or 3.5in; if not, it's low density. Here is my version of that free space code: REM Gets freespace & total formatted space on the Default drive TYPE REGTYPE ' For CALL INTERRUPT AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER BP AS INTEGER SI AS INTEGER DI AS INTEGER FL AS INTEGER DS AS INTEGER ES AS INTEGER END TYPE DIM INR AS REGTYPE, OUR AS REGTYPE INR.AX = &H3600 ' INR.DX can contain a drive designator ' (0=default, 1=A:,2=B:, ...) CALL INTERRUPT(&H21, INR, OUR) A& = OUR.AX: B& = OUR.BX: C& = OUR.CX: D& = OUR.DX PRINT D& * C& * A&; "bytes total,"; B& * C& * A&; "free." Large partitions (like my 330Mb 'C:' drive) sometimes return a negative value for the total free space... these problems did not exist in the days of 32Mb max. size partitions. Guess I'll have to review the above code some day. --- ME2_1104 * Origin: Out of String Space - the Final Frontier (Fidonet 1:163/506.2)
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