I’m trying to get the free space on my disk (in this case /dev/hd0t79) using
statvfs() (I currently get zero from both disk space feilds). I’ve read
through the archives, so I already know that if you give statvfs() the wrong
file it will return correct disk capacity, but wrong free space info.
What am I doing wrong here?
struct statvfs stat_fs;
if (statvfs("/dev/hd0t79", &stat_fs)!=0)
printf(“Disk space available %ld MB\n”,
(unsigned long) stat_fs.f_bfree * stat_fs.f_bsize);
printf(“Total disk free space %ld MB\n”,
(unsigned long) stat_fs.f_bavail * stat_fs.f_bsize);
Disk space available 0 MB
Total disk free space 0 MB