리눅스에서 cd는 디렉토리를 변경하고,
pwd는 현재 작업 디렉토리를 보여준다.
그걸 api 수준에서 보자면
cd는 chdir() 이고
pwd는 getcwd() 이다.
[링크 : http://linux.die.net/man/3/getcwd]
[링크 : http://linux.die.net/man/3/chdir]
2010.04.20 추가
코드샘플
pwd는 현재 작업 디렉토리를 보여준다.
그걸 api 수준에서 보자면
cd는 chdir() 이고
pwd는 getcwd() 이다.
| long getcwd(char *buf, unsigned long size); #include <unistd.h> int chdir(const char *path); int fchdir(int fd); |
[링크 : http://linux.die.net/man/3/getcwd]
[링크 : http://linux.die.net/man/3/chdir]
코드샘플
#include "unistd.h"
void main()
{
int ret;
char buff[256];
getcwd(buff, 255);
printf("%s\n",buff);
ret = chdir("/etc");
getcwd(buff, 255);
printf("%s\n",buff);
}
|
'Linux' 카테고리의 다른 글
| enscript (0) | 2010.04.28 |
|---|---|
| readlink() 와 심볼릭 링크, 그리고 inode(아이노드) (0) | 2010.04.20 |
| wget (4) | 2010.04.10 |
| /dev의 major minor에 대하여 (0) | 2010.04.08 |
| gethostname() 과 gethostbyname() - difference of gethostname() and gethostbyname() (4) | 2010.04.05 |