2.1.10.61 _chdrive


Description

change the current working drive

Syntax

int _chdrive( int drive )

Parameters

drive
[input] Number of new working drive, A drive is 1, B drive is 2, C drive is 3, and so on.

Return

returns a value of 0 if the working drive is successfully changed. A return value of -1 indicates an error.

Examples

EX1

void    chdrive_ex1()
{
    int        nCurrentDrive = _getdrive();
    printf("Current drive is %c\n", (char)(nCurrentDrive + 'A' - 1));
    
    if (0 == _chdrive(4))
    {
        nCurrentDrive = _getdrive();
        printf("Current drive is %c\n", (char)(nCurrentDrive + 'A' - 1));
    }
    else
        out_str("Failed to change current drive!");
}

Remark

Changes the current working drive.

See Also

Header to Include

origin.h

Reference