⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsk_free.c

📁 [随书类]Dos6.0源代码
💻 C
字号:
/***************************************************************************/
/*																									*/
/*	DSK_FREE.C																					*/
/*																									*/
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Returns the number of free bytes on the specified disk. Uses DOS get		*/
/* disk free call for information about the disk and then calculates the	*/
/* number of free bytes.																	*/
/*																									*/
/*	long GetDiskFree( int DrvLetter )													*/
/*																									*/
/* ARGUMENTS:	DrvLetter	- DOS drive letter										*/
/* RETURNS:		long			- Number of free bytes for the specified disk	*/
/*									  or -1L if there is an error reading the disk	*/
/*																									*/
/* Created 07-23-89 johnhe																	*/
/***************************************************************************/

#include 	<dos.h>

#include 	<alias.h>
#include 	<disk_io.h>

long GetDiskFree( int DrvLetter )
{
	struct diskfree_t 	sDrive;
	unsigned					iBytesPerClus;

	DrvLetter -= 0x40;
	if ( _dos_getdiskfree( (unsigned)DrvLetter, &sDrive ) != OK )
		return( -1L );

	iBytesPerClus = sDrive.bytes_per_sector * sDrive.sectors_per_cluster;

	return( (long)(sDrive.avail_clusters) * (long)(iBytesPerClus) );
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -