RAD Studio |  |

_getdrive

Header File

dos.h

Category

Directory Control Routines

Prototype

int _getdrive(void);

Description

Gets the current drive.

_getdrive gets the the current drive number. It returns an integer: 0 for A, 1 for B, 2 for C, and so on.

Return Value

_getdrive returns the current drive number on success or -1 in the event of error.

Example

Copy Code

    #include <stdio.h>
    #include <direct.h>
    int main(void)
    {
      int disk;
      disk = _getdrive() + 'A' - 1;
      printf("The current drive is: %c\n", disk);
      return 0;
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!