There seem to be many different ways to seek in C:
fseek()fsetpos()fseeko()lseek()And many seem to have *64() versions:
fseeko64()lseek64()To complicate matters further many seem to require macro definitions (like _LARGEFILE64_SOURCE or _GNU_SOURCE) to be available or to use 64-bit versions.
What is the easiest way to guarantee 64-bit IO using ANSI C on Windows, Linux, Mac, BSD, Solaris, etc., and since when has it been supported by each OS?
Code works needs to employ at least 1 of the below restriction::
long is 64-bit+, then use fseek().
Only seek to locations that code has been to before as a result of fread(), fgets(), fscanf(), fgets(), and so use fgetpos(), fsetpos(). This is the best way if the file is a text file.
Have access to a platform dependent 64-bit seek such as lseek64().
Multiple 32-bit fseek().
Use grossly inefficient code with rewind() and fgetc()/fread().
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