📄 fchdir_test.c
字号:
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <errno.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <fcntl.h>int main(int argc, char **argv){ int fd; int rc; fd = open(".", O_RDONLY); if (fd < 0) { perror("opening '.' :"); exit(2); } rc = chdir("/mnt/lustre/subdir/subdir"); if (rc) { perror("cannot chdir subdir:"); exit(3); } rc = fchdir(fd); if (rc) { perror("cannot fchdir back\n"); exit(4); } rc = close(fd); if (rc) { perror("cannot close '.'\n"); exit(5); } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -