c语言清除磁盘存储空间,c语言里如何获得磁盘剩余空间,急

c语言里如何获得磁盘剩余空间,急

|

struct BF_TYPE

{

char notes[20];

char bf_path[80];

char newfile_name[40];

time_t newfile_time;

time_t current_time;

double bf_size;

double bf_free;

double f_size;

time_t scan_time;

char chck_usr[16];

};

struct BF_LISTTYPE

{

char bf_path[80];

char bf_chkstr[20];

char notes[20];

int timediff;

char other2[16];

};                     /*其它不必理会,你的例子只要bf_path*/

int get_statfs(struct   BF_TYPE   *bf,struct   BF_LISTTYPE   *bl)

{

struct   statfs   myfs;

strcpy(bf->notes,bl->notes);

if   (statfs(bl->bf_path,&myfs)==-1)   { perror("statfs   error!!"); return(-1); }

strcpy(bf->bf_path,bl->bf_path);

bf->bf_size   =(double)myfs.f_blocks*(double)myfs.f_bsize/1024;

bf->bf_free   =(double)myfs.f_bavail*(double)myfs.f_bsize/1024;

return(bf->bf_free*100/bf->bf_size);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值