The code currently does this and the fgetpos does handle files larger than 4GB but the seek returns an error, so any idea how to seek to the end of a file > 4GB
?
fpos_t currentpos;
sok=fseek(fp,0,SEEK_END);
assert(sok==0,"Seek error!");
fgetpos(fp,¤tpos);
m_filesize=currentpos;
Ignore all the answers with "64" appearing in them. On Linux, you should add -D_FILE_OFFSET_BITS=64
to your CFLAGS and use the fseeko
and ftello
functions which take/return off_t
values instead of long
. These are not part of C but POSIX. Other (non-Linux) POSIX systems may need different options to ensure that off_t
is 64-bit; check your documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With