Chinaunix首页 | 论坛 | 博客
  • 博客访问: 968697
  • 博文数量: 200
  • 博客积分: 5011
  • 博客等级: 大校
  • 技术积分: 2479
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-27 15:07
文章分类

全部博文(200)

文章存档

2009年(12)

2008年(190)

我的朋友

分类:

2008-11-03 17:44:54

4.22 chdir, fchdir, getcwd

每个process都有自己的current working directory,在shell里执行cd命令是一个built in command,因为如果它不是的话,他只能改变它所在的子进程的current working directory,而不能影响父进程的环境。所以cd要做成built in comand

#include

 

int chdir(const char *pathname);

 

int fchdir(int filedes);

 

Both return: 0 if OK, 1 on error

#include

 

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

 

Returns: buf if OK, NULL on error

Fchdir可以用一个directorydescriptor来作为切换目录的参数。

 

阅读(594) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~