| cvs.gedasymbols.org/djgpp/doc/libc/libc_561.html | search | 
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
#include <dos.h> int _media_type( const int drive );  | 
This function checks if drive number drive (1 == A:, 2 == B:, etc., 0 == default drive) is fixed or removable.
_media_type should only be called after you are sure the drive
isn't a CD-ROM or a RAM disk, since these might fool you with this
call.  
1 if the drive is a fixed disk, 0 if it is removable. -1 on error.
| ANSI/ISO C | No | 
| POSIX | No | 
#include <stdio.h>
#include <dos.h>
int main(void)
{
  if( _media_type( 'C' - 'A' + 1 ) )
  {
    printf("C: is (probably) a hard drive.\n");
  }
  else
  {
    printf("C: is (probably) a removable drive.\n");
  }
  exit(0);
}
 | 
| webmaster | delorie software privacy | 
| Copyright © 2004 | Updated Apr 2004 |