www.delorie.com/djgpp/doc/libc/libc_376.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

_get_fat_size

Syntax

 
#include <dos.h>

int _get_fat_size( const int drive );

Description

This function tries to determine the number of bits used to enumerate the clusters by the FAT on drive number drive. 1 == A:, 2 == B:, etc., 0 == default drive.

This function will not succeed on DOS version < 4, setting errno to ENOSYS. It is also known to have trouble detecting the file system type of disks formatted with a later version of DOS than the version it is run on. E. g. floppies with LFN entries can cause this function to fail or detect the fat size as 16 if used in plain DOS.

If you are looking for a function that is able to detect other file systems, perhaps the function _get_fs_type (see section _get_fs_type) can be of use.

Return Value

The number of bits used by the FAT (12, 16 or 32). 0 if the drive was formatted with FAT but of unknown size (NT reports that on FAT16). -1 on error.

Portability

ANSI/ISO C No
POSIX No

Example

 
#include <stdio.h>
#include <dos.h>

int main(void)
{
  int size;

  size = _get_fat_size( 'C' - 'A' + 1 );
  if( 0 <= size )
  {
    printf("The size of FAT on C: is %d bits.\n", size);
  }

  exit(0);
}


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004