Why Are FAT32 Drives Limited to 4GB Files? Since FAT32 is 32-bit, the maximum possible value (all 1's) for that 32-bit field is 2^32, which counts to 4 Gigabytes. Hence FAT32 can support a maximum file size of 4GB.
Locate the file or folder whose size you would like to view. Click the file or folder. Press Command + I on your keyboard. A window opens and shows the size of the file or folder.
I made a simple function, which get's a file's size.
int file_size( char * filename )
{
int size;
struct stat st;
stat( filename, &st );
size = st.st_size;
return size;
}//file_size
It is working fine, but if i have a file which size is bigger than 4Gb than i get a negativ number back, and of course this isn't the correct file size. So how can i get such a big file's size? I think, that the return value should anything else like int but i don't know what, and i don't think, that would solve my problem.
Thanks,
kampi
Update:
Hi!
I found the solution. I have to use __stat64. I modifyed my function, and now it is retrieving the real size. I tested it with an 8Gb big file.
unsigned long long int file_size( char * filename )
{
unsigned long long int size;
struct __stat64 st;
__stat64( filename, &st );
size = st.st_size;
return size;
}//file_size
And a notice:
When i used printf, i had to use "%I64d" to print it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With