The ftell
function returns a long, which means that on an ILP32 system you can't correctly get the size of a file larger than 2GB. You should use the stat
function or similar to get the size of a file; check the manual for the operating system you're targeting in case you have use a different function name (stat64) or define a preprocessor macro to get the desired behavior for large files.