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

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

_media_type

Syntax

 
#include <dos.h>

int _media_type( const int drive );

Description

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.

Return Value

1 if the drive is a fixed disk, 0 if it is removable. -1 on error.

Portability

ANSI/ISO C No
POSIX No

Example

 
#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   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004