Borland C++ reference

_chdrive

raw OCR

Sets current disk drive.

Defined in header <direct.h>

Syntax

#include <direct.h>
int _chdrive(int drive);

Portability

DOSUNIXWindowsANSI CC++ 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`