_chdrive
raw OCR
Sets current disk drive.
Defined in header <direct.h>
Syntax
#include <direct.h>
int _chdrive(int drive);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
_chdrive sets the current drive to the one associated with drive: 1 for A, 2 for B, 3 for C, and so on.
Return value
_chdrive returns 0 if the current drive was changed successfully; otherwise, it returns -1.
See also
Example
#include <stdio.h>
#include <direct.h>
int main(void)
{
if (_chdrive(3) ==0)
printf ("Successfully changed to drive C:\n");
else
printf ("Cannot change to drive C:\n");
return 0;
}
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `chdrive` read as `_chdrive`
Stable link: /3.1/direct.h/_chdrive/
· short form /3.1/_chdrive/