Get the large file size


#define _LARGEFILE64_SOURCE
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>

int main(int argc, char** argv) {
    int fd;
    off64_t pos;
    if (argc <= 1) return -1;
    printf("%d %s\n", argc, argv[1]);
    fd = open(argv[1], O_RDONLY);
    if (-1 == fd) {
        printf("open failed\n");
        return -1;
    }
    pos = lseek64(fd, 0, SEEK_END);
    printf("size = %ld\n", pos);
    close(fd);
    return 0;
}



留言