You have a largefiles problem. Base stat has a size_t st.size element. It can handle up to the max un unsigned loing value can store.
If the output of this:
is less than the size of the file then that is your problem. You will have to do some reading on large files for your system - there may be a stat64 or fstat64 call which will handle the issue. What OS?