SSS
SSS

Reputation: 1

In Linux, why lseek(1.txt, 0 , SEEK_END) = 1.txt's size +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

Answers (0)

Related Questions