StudyingUnixInterface/4/fileDirectory/chdir.c
2020-12-08 11:33:48 +08:00

16 lines
234 B
C

#include <unistd.h>
#include <stdio.h>
int main(void) {
if(chdir("/home/eric") < 0) {
printf("chdir error\n");
return -1;
}
char buf[1024];
char *pbuf = getcwd(buf, 1024);
printf("CWD: %s\n", pbuf);
return 0;
}