函数名: getfat, getfatd
功 能: 取文件分配表信息
用 法: #include <dos.h>
void getfat(int drive, struct fatinfo *fatblkp);
程序例:
#include <stdio.h>
#include <dos.h>
int main(void)
{
struct fatinfo diskinfo;
int flag = 0;
printf("Please insert disk in drive A\n");
getchar();
getfat(1, &diskinfo);
/* get drive information */
printf("\nDrive A: is ");
switch((unsigned char) diskinfo.fi_fatid)
{
case 0xFD:
printf("360K low density\n");
break;
case 0xF9:
printf("1.2 Meg high density\n");
break;
default:
printf("unformatted\n");
flag = 1;
}
if (!flag)
{
printf(" sectors per cluster %5d\n",
diskinfo.fi_sclus);
printf(" number of clusters %5d\n",
diskinfo.fi_nclus);
printf(" bytes per sector %5d\n",
diskinfo.fi_bysec);
}
return 0;
}