I\'m trying to write a large file, but ran into a problem.
I use long long for seeking a place to write, but can\'t write file more than 4,2Gb. What I forgot?
Mo
fseeko64 (Filename, 0, SEEK_END);
long size = ftello64 (Filename);
fclose (Filename);
For accessing the large files , fseek cannot be used , instead have to go for fseeko64();
There is a nice summary for Linux here:
http://www.suse.de/~aj/linux_lfs.html
And more specific detail from RedHat targetting RHEL, these problems are generally for 32-bit applications accessing 64-bit sized files.
http://people.redhat.com/berrange/notes/largefile.html
Wikipedia actually has an artile on Large File Support but not really that informative.
There's a function called _lseeki64() on Win32, and lseek64() on *nix. The iostream library, however, does not wrap them directly, you'll have to retrieve the file descriptor somehow, and do something about buffering.
Many filesystems do not support files larger than 4GB. In addition, you should consider that your int
type may have a range that ends at 2^32
, i.e. 4.29497e+09.