8Linux服务器编程之:chdir()函数和cd命令,getcwd()函数和pwd

时间:2014-09-16 00:24:39   收藏:0   阅读:207


1chdir依赖的头文件

#include<unistd.h>

2函数定义

int chdir(const char *path);

int fchdir(int fd);

函数说明:

chdir的作用是改变工作目录

4getcwd依赖的头文件

#include<unistd.h>

5函数定义:

char *getcwd(char *buf, size_t size);

函数说明,通过这个函数获得路径

6.案例说明:

bubuko.com,布布扣

bubuko.com,布布扣

7.pathconf依赖的头文件

#include<unistd.h>               

函数定义:

longfpathconf(int fd, int name);

longpathconf(char *path, int name);

8案例说明

下面的案例是求文件名的最大长度

bubuko.com,布布扣

运行结果:

bubuko.com,布布扣

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!