#include <stdio.h>
#include <direct.h> // chdir
#ifndef _MAX_PATH
#define _MAX_PATH 260
#endif // _MAX_PATH
int main(){
char strBuffer[_MAX_PATH]={0,};
char strChangeDir[_MAX_PATH]={"..\\"};
char *pStrBuffer = NULL;
pStrBuffer = _getcwd(strBuffer, _MAX_PATH);
printf("Beginning path : %s\n", strBuffer);
int nResult = _chdir(strChangeDir);
if ( nResult == 0 ){
printf( "Successed\n" );
pStrBuffer = _getcwd(strBuffer, _MAX_PATH);
printf( "Ending path : %s\n", strBuffer);
} else {
perror( "Failed" );
}
return 0;
}
< 테스트 결과 (Result of test) >