Problem is, if the fileSize is larger than 4gb, the size seems to.. wrap.. :)
so a 5 gb file, would return 1gb because 4gb is the maxiumum.
I'm not asking to increase the limit of my programs ability to load large files, but can i make the program check if the file is larger than the maximum?
Or check how many times that the program wraps.
Basically i just want to limit my program to reading 4GB files, but i cant do this because if the filesize is larger than 4gb, it just wraps back to 0 :/
I think a more suffice answer would be to seek to the position of 4GB - 1 (very last byte in the largest file available) and checking to see if you actually moved there. If the seek completed successfully, then the file is 4GB or larger. At that point, you should save the current size and continue reading.
In cases like this, it's much easier to either:
1. Not even bother handling it. Just put in the documentation "don't use with files larger than 4 GiB". It sounds cheap, but it's perfectly legitimate. A program doesn't need to be prepared to handle every possible situation, if it's unreasonable to do so.
2. Use a different library for file handling, since the standard one is stupid.