Borland C++ reference

_getdrive

raw OCR

Gets current drive number.

Defined in header <direct.h>

Syntax

#include <direct.h>
int _getdrive(void);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

_getdrive uses DOS function 0x19 to get the current drive number. It returns an integer: 1 for A, 2 for B, 2 for 3, and so on.

Return value

_getdrive returns the current drive number.

See also

Example

#include <stdio.h>
iinclude <direct.h>

int main(void)
{
   int disk;
   disk = _getdrive() +  'A' - 1;
   printfC'The current drive is: %c\n", disk) ;
   return 0;
}

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.