Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_getdrive() get current working drive</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _getdrive()             Get Current Working Drive

 #include   <direct.h>

 int _getdrive(void);

    _getdrive() simply returns the current working drive as an integer
    (i.e. 1=A, 2=B...). The current working drive is also known as the
    default drive.

    Returns:    The current working drive (1=A, 2=B...).

 Portability:   Not supported by the ANSI standard.

   -------------------------------- Example ---------------------------------

        #include <stdio.h>
        #include <conio.h>
        #include <stdlib.h>

        void main()
        {
            int charac, workingdrive;
            static char path[_MAX_PATH];

            workingdrive = _getdrive();

            printf("Switching to drive B: \n");

            _chdrive(2);

            printf("Type a character to switch to original drive. \n");
            charac = getch();

            _chdrive(workingdrive);
        }

See Also: getcwd()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson