change the current working drive
int _chdrive( int drive )
returns a value of 0 if the working drive is successfully changed. A return value of -1 indicates an error.
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!"); }
Changes the current working drive.
origin.h