Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic


Changes the current working drive.

int _chdrive( 
   int drive 


Number of new working drive.

Return Value

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


The _chdrive function changes the current working drive to the drive specified by drive. The drive parameter uses an integer to specify the new working drive (1=A, 2=B, and so forth). This function changes only the working drive; _chdir changes the working directory.


Routine Required header Compatibility
_chdrive <direct.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.


See the example for _getdrive.

See Also

Directory Control Routines | _chdir | _fullpath | _getcwd | _getdrive | _mkdir | _rmdir | system | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.