getfat
raw OCR
Gets file allocation table information for given drive.
Defined in header <dos.h>
Syntax
#include <dos.h>
void getfat(unsigned char drive, struct fatinfo *dtahle);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
getfat gets information from the file allocation table (FAT) for the drive specified by drive (0 for default, 1 for A, 2 for B, and so on), dtable points to the fatinfo structure to be filled in. The fatinfo structure filled in by getfat is defined as follows:
struct fatinfo {
| char fi_sclus; | /* sectors per cluster */ |
| char fi_fatid; | /* the FAT id byte */ |
| unsigned fi_nclus; | /* number of clusters */ |
| int fi_bysec; }; | /* bytes per sector */ |
Return value
None.
See also
Example
#include <stdio.h> *
#include <conio.h>
finclude <dos.h>
int mainO
{
struct fatinfo diskinfo;
int flag = 0;
printf("Please insert a diskette in drive 'A'\n");
getchO ;
getfat(1, &diskinfo) ; /* get drive information */
printf("\nDrive A: is ");
switch((unsigned char) diskinfo. fi_fatid) {
case 0xFD: printf ("a 360K low density\n");
break;
case 0xF9: printfC'a 1.2 Meg 5-l/4\" or 720 K 3-l/2\"\n"
break;
case OxFO: printf ("1.44 Meg 3-l/2\"\n");
break; .
default: printf ("unformatted\n");
flag =1;
}
if (!flag) {
printf I"sectors per cluster: %5d\n", diskinfo.fi_sclus)
printf I"number of clusters: %5d\n", diskinfo.fi_nclus)
printf("bytes per sector: %5d\n", diskinfo.fi_bysec)
}
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dos.h/getfat/
· short form /3.1/getfat/