According to this wikipedia page, the size of a individual file on Win10 can go up to about 8 PB with NTFS. Yet the struct Stat is defined as
struct stat
{
_dev_t st_dev;
_ino_t st_ino;
unsigned short st_mode;
short st_nlink;
short st_uid;
short st_gid;
_dev_t st_rdev;
_off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
};
where off_t is type defined as long. That means a roughly 4 GB limit. According to this stackoverflow page, even for 32-bit OS, the size of a file can be larger than it.
Unless I have mistaken something, how can one use struct stat to get the size of a file reliably. Furthermore, what will happen if the file size exceeds the limit of the long type?