#include <sys/statvfs.h>
int GET_DISK_SPACE()
{
struct statvfs sbuf;
statvfs("/home/odroid", &sbuf);
printf("Bytes left:%ld\n", sbuf.f_frsize*sbuf.f_bavail);
}
Wrote this simple function to get disk space on my linux machine and it returns negative value.
original: -89366528
Then I added a simple text file with Size: 877 bytes | Size on disk: 4.00 KB
and the value changed to -89370624
Then duplicated the file and got -89374720
These numbers don't make any sense. Not sure what I'm doing wrong.
When I run df -h
this is what I get