#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> void main(){ //打开文件 int fd; fd = open("./test.c", O_RDWR | O_CREAT, 0777); if(fd < 0 ){ printf("File not exist! "); } //写入文件 char wbuf[10] = "12345"; write(fd, wbuf, 5); //定位文件 lseek(fd, 0, SEEK_SET); //读取文件 char rbuf[10]; read(fd, rbuf, 5); rbuf[5] = '