摘要: 使进程执行某一程序。成功无返回值,失败返回 -1 int execlp(const char *file, const char *arg, ...); 借助 PATH 环境变量找寻待执行程序 参1: 程序名 参2: argv0 参3: argv1 ...: argvN 哨兵:NULL int ex 阅读全文
posted @ 2020-12-09 20:30 INSTANCE_SELF 阅读(112) 评论(0) 推荐(0) 编辑
摘要: fork函数: pid_t fork(void) 创建子进程。父子进程各自返回。父进程返回子进程pid。 子进程返回 0. getpid();getppid(); >0 父进程 =0 子进程 循环创建N个子进程模型。 每个子进程标识自己的身份。 父子进程相同: 刚fork后。 data段、text段 阅读全文
posted @ 2020-12-09 20:28 INSTANCE_SELF 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #include <unistd.h> #include <sys/stat.h> #include <dirent.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define PATH_LEN 256 //dir=/h 阅读全文
posted @ 2020-12-09 20:27 INSTANCE_SELF 阅读(132) 评论(0) 推荐(0) 编辑
摘要: lseek函数: /**/ off_t lseek(int fd, off_t offset, int whence); 参数: fd:文件描述符 offset: 偏移量 whence:起始偏移位置: SEEK_SET/SEEK_CUR/SEEK_END 返回值: 成功:较起始位置偏移量 失败:-1 阅读全文
posted @ 2020-12-09 20:26 INSTANCE_SELF 阅读(94) 评论(0) 推荐(0) 编辑
摘要: (1)open函数: #include <unistd.h> int open(char *pathname, int flags) 参数: pathname: 欲打开的文件路径名 flags:文件打开方式: #include <fcntl.h> O_RDONLY|O_WRONLY|O_RDWR O 阅读全文
posted @ 2020-12-09 20:25 INSTANCE_SELF 阅读(88) 评论(0) 推荐(0) 编辑