博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C语言chdir()函数:改变当前的工作目录
阅读量:4165 次
发布时间:2019-05-26

本文共 301 字,大约阅读时间需要 1 分钟。

相关函数:getcwd, chroot


头文件:#include <unistd.h>


定义函数:int chdir(const char * path);


函数说明:chdir()用来将当前的工作目录改变成以参数path 所指的目录.


返回值执:行成功则返回0, 失败返回-1, errno 为错误代码.


范例

#include <unistd.h>

main()

{

    chdir("/tmp");

    printf("current working directory: %s\n", getcwd(NULL, NULL));

}


执行:

current working directory :/tmp

转载地址:http://zzexi.baihongyu.com/

你可能感兴趣的文章
2019.9.37
查看>>
2019.9.38
查看>>
2019.9.41
查看>>
2019.9.42
查看>>
2019.9.43
查看>>
2019.9.44
查看>>
2019.9.45
查看>>
2019.10.3
查看>>
2019.10.4
查看>>
2019.10.5
查看>>
2019.10.6
查看>>
2019.10.7
查看>>
2019.10.8
查看>>
人智导(二十一):规划(上)
查看>>
2019.11.27
查看>>
2019.11.28
查看>>
人智导(二十二):规划(下)
查看>>
Conda 安装PIL失败
查看>>
PIL报错:TypeError: Cannot handle this data type: (1, 1, 3), <f8
查看>>
2019.11.29
查看>>