This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

file size upper limit

hi TI-friends,

 as we know there's a upper limit when using standard c functions like open/write/read/fstat.

I try to get the size of a big file by using fstat64(), and I found that I can't declare as below due to compiling error

struct stat64 stat64_buf;

but I compile successfully as using open64/fstat64 which are also the standard c functions

Is there anything I miss??

  • add compile option like this:

    CFLAGS += -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64

  • thanks for your reply~~

    I add following in my code

        struct stat64 stat_buf64; /* argument to fstat */

        off_t64 offset64 = 0; /* file offset */

    the headers I used are

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

    the result I got is 

    [/home/Projects/TI-8168/network] $ /root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc -g client.c -o client_arm -D_FILE_OFFSET_BITS=64 -D__USE_LARGEFILE64
    client.c: In function 'main':
    client.c:35: error: storage size of 'stat_buf64' isn't known
    client.c:36: error: 'off_t64' undeclared (first use in this function)
    client.c:36: error: (Each undeclared identifier is reported only once
    client.c:36: error: for each function it appears in.)
    client.c:36: error: expected ';' before 'offset64'

    Do I forget something ??

  • correction

    off_t64 offset64 = 0; /* file offset */

    ==>

    off64_t offset64 = 0; /* file offset */

  • try this

    -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64