The use
功能
Change the current working directory.
切换当前工作目录
The prototype
函数原型
int _chdir(const char *dirname);
/* for wide character */
int _wchdir(const wchar_t *dirname);
Example
实例
charpath1[50] = \"C:\\WINNT\\System32\\config\";
_chdir(path1);
The parameters
参数
dirname - Path of new working directory.
Dirname- 工作目录的完整路径
The return value
返回值
These functions return a value of 0 if successful. A return value of –1 indicates that the specified path
could not be found, in which case errno is set to ENOENT.
函数成功执行返回0值。
返回值= -1 时表示找不到指定路径,
当函数执行失败,用GetLastError函数获取的返回值为 ENOENT
The header file
头文件
<direct.h> or <wchar.h> for_wchdir().
Table 8: _chdir(),_wchdir() functions information
表8 _chdir(),_wchdir()函数
§ The _chdir() function changes the current working directory to the directory specified by dirname. The dirname parameter must refer to an existing directory.
§ _chdir()