#include #include #include #include #include int main(){ int fd, pid, n; char buf[10]; fd = open("test.txt", O_RDWR); pid = fork(); if(pid == 0){ write(fd, "FOXLIVER", O_RDWR); close(fd); exit(0); }else{ wait(0); lseek(fd, 0, SEEK_SET); n = read(fd, buf, 9); buf[n] = '\0'; printf("%s \n", buf); close(fd); } return 0; }