home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power CD-ROM!! 7
/
POWERCD7.ISO
/
prgmming
/
clipper
/
clustfre.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-14
|
2KB
|
88 lines
/*
* File......: CLUSTFRE.C
* Author....: Dave Pearson
* BBS.......: The Dark Knight Returns
* Net/Node..: 050/069
* User Name.: Dave Pearson
* Date......: $Date$
* Revision..: $Revision$
* Log file..: $Logfile$
*
* This is an original work by Dave Pearson and is placed in the public
* domain.
*
* Modification history:
* ---------------------
*
* $Log$
*
*/
// NOTE: This code has been written for and compiled with Borland C++
// Version 3.1
//
#include <extend.h>
#include "internal.h"
/* $DOC$
* $FUNCNAME$
* GT_CLUSFRE()
* $CATEGORY$
* Disk Drive
* $ONELINER$
* Get the number of free clusters on a drive.
* $SYNTAX$
* GT_ClusFre([<ncDrive>]) --> nClusters
* $ARGUMENTS$
* <ncDrive> is an optional parameter that is the id of the drive
* to be read. This paramater can be either a character value who's
* first character is taken as the drive letter or a numeric value
* where 0 = Default, 1 = A:, 2 = B:, etc... If no parameter is
* passed the default drive is used.
* $RETURNS$
* The numer of free clusters on the drive. If the drive is invalid
* the return value will be -1.
* $DESCRIPTION$
* GT_ClusFre() can be used to find the number of free clusters on
* a disk.
* $EXAMPLES$
* // Each of the following print the number of free clusters found
* // on drive C:
*
* ? GT_ClusFre("C:")
* ? GT_ClusFre("C")
* ? GT_ClusFre("Clipper") // First letter is used only.
* ? GT_ClusFre(3)
*
* // The next two print the number of free clusters in the current
* // drive.
*
* ? GT_ClusFre(0)
* ? GT_ClusFre()
* $SEEALSO$
* GT_SECTSIZ() GT_CLUSTER() GT_SECPCLU()
* $END$
*/
CLIPPER GT_ClusFre()
{
char Drive = _GT_Internal_GetDriveName(1);
unsigned Result;
unsigned Error;
asm Mov AH,0x36
asm Mov DL,Drive
asm Int 0x21
asm Mov Result,BX;
asm Mov Error,AX;
if (Error == 0xFFFF)
{
_retnl(-1);
}
else
{
_retnl(Result);
}
}