I've been trying to figure out a way to read files that are larger than a computers system memory. I've sort of been able to do it with the bastardization of code below that reads character by character into a char array.
In the process it over writes the same memory, but it is horribly slow and leaves of parts of files. So basically how do I read large files the right way.
You don't need to seek before reading each character.
Also, if the file is 100,000,032 bytes in size, then it appears to me like the loop reads and discards the first 100,000,000 bytes into the data array. Only the last 32 bytes are kept. If that's the case then just seek to end-32 and read the data you want.
Finally, to get the size of the file, see if your system supports stat(). It will probably be faster than opening and closing the file.