RAD Studio
ContentsIndex
PreviousUpNext
_chdrive

Header File 

direct.h  

Category 

Directory Control Routines 

Prototype 

int _chdrive(int drive); 

Description 

Sets current disk drive. 

_chdrive sets the current drive to the one associated with drive: 1 for A, 2 for B, 3 for C, and so on. 

This function changes the current drive of the parent process. 

Return Value 

_chdrive returns 0 if the current drive was changed successfully; otherwise, it returns -1. 

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;
}

Portability

POSIX 
Win32 
ANSI C 
ANSI C++ 
 
 
 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!