HI,
I want find hard disk free space.
I tried to find by using statfs() function .But vaules that are coming from the statfs() function is different from the one i am getting using "df" command .
code:
#include<sys/types.h>
#include<sys/stat.h>
#include<sys/vfs.h>
#include<stdio.h>
#include<iostream.h>
main()
{
long nFreeSpace=0;
struct statfs *pStatfs;
pStatfs = new struct statfs;
statfs("/",pStatfs);
nFreeSpace = pStatfs->f_bfree;
printf("%d \n", nFreeSpace);
}
provide solution to find the free harddisk space.
I am using Redhat Linux7.2 ,gcc version 2.96 to compile the above program
Thanks
varthim
I want find hard disk free space.
I tried to find by using statfs() function .But vaules that are coming from the statfs() function is different from the one i am getting using "df" command .
code:
#include<sys/types.h>
#include<sys/stat.h>
#include<sys/vfs.h>
#include<stdio.h>
#include<iostream.h>
main()
{
long nFreeSpace=0;
struct statfs *pStatfs;
pStatfs = new struct statfs;
statfs("/",pStatfs);
nFreeSpace = pStatfs->f_bfree;
printf("%d \n", nFreeSpace);
}
provide solution to find the free harddisk space.
I am using Redhat Linux7.2 ,gcc version 2.96 to compile the above program
Thanks
varthim