#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
main()
{
int fd;
off_t offset;
fd = open("test.txt", O_RDONLY);
offset = lseek(fd, -10, SEEK_END);
printf("The offset is %d\\n",offset);
offset = lseek(fd, 5, SEEK_CUR);
printf("The offset is %d\\n",offset);
return 0;
}
[root@localhost LSEEK]# ./lseek.exe
The offset is 29
The offset is 34
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |