chinaunix网友2008-10-30 19:53:56
#include
#include
int get_cf_size_inbytes(long long *ptotalsize, long long *pfreesize)
{
struct statfs stbuf;
if (statfs("/tmp/", &stbuf) < 0 )
return -1;
if ( ptotalsize ) *ptotalsize = stbuf.f_blocks * stbuf.f_bsize;
if ( pfreesize ) *pfreesize = stbuf.f_bfree * stbuf.f_bsize;
return 0;
}
int main()
{
long long total_size,free_size;
get_cf_size_inbytes(&total_size,&free_size);
printf("sunjing total_sizeis %ld free_size is