Reputation: 1
In Linux, why lseek(1.txt, 0 , SEEK_END) = (number of texts in 1.txt) + 1, (but, if file empties lseek() is 0) ??
#include<stdio.h>
#include<unistd.h>
#include<fcntl.h>
int main(int argc, char *argv[]){
int fd;
fd=open(argv[1], O_RDWR);
printf("file size : %ld\n",lseek(fd, (off_t)0 ,SEEK_END));
}
Upvotes: 0
Views: 23