Change fseek ftell method for file size to fstat.

fseek-ing to the end of a file is not guaranteed to work, and doesn't work in g++. The fstat method is more portable.