23,121
社区成员
发帖
与我相关
我的任务
分享
这是源程序:
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdio.h>
int main(void)
{
int fd, i, rev;
char buf[] = "hello world";
fd = open("temp.log",O_WRONLY|O_CREAT);
for(i = 0; i < 10; i++)
{
write(fd, buf, sizeof(buf));
lseek(fd, -5, SEEK_CUR);
}
close(fd);
return 0;
}