怎样计算磁盘的剩余空间及判断磁盘已满?

topcool99 2004-10-24 03:14:04
用c/c++怎样计算磁盘的剩余空间及判断磁盘已满?
...全文
384 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
topcool99 2004-10-28
  • 打赏
  • 举报
回复
?????上位!
好象代码有点偏差啊????

提问:
1。我们可以自己结构体吗?

2。怎样输出驱动器的剩余磁盘空间?
tmdgood 2004-10-27
  • 打赏
  • 举报
回复
呵呵,没试过,不知道行不
tmdgood 2004-10-27
  • 打赏
  • 举报
回复
我贴:

函数名: getfat, getfatd
功 能: 取文件分配表信息
用 法: void getfat(int drive, struct fatinfo *fatblkp);
程序例:

#include <stdio.h>
#include <dos.h>

int main(void)
{
struct fatinfo diskinfo;
int flag = 0;

printf("Please insert disk in drive A\n");
getchar();

getfat(1, &diskinfo);
/* get drive information */

printf("\nDrive A: is ");
switch((unsigned char) diskinfo.fi_fatid)
{
case 0xFD:
printf("360K low density\n");
break;

case 0xF9:
printf("1.2 Meg high density\n");
break;

default:
printf("unformatted\n");
flag = 1;
}

if (!flag)
{
printf(" sectors per cluster %5d\n",
diskinfo.fi_sclus);
printf(" number of clusters %5d\n",
diskinfo.fi_nclus);
printf(" bytes per sector %5d\n",
diskinfo.fi_bysec);
}

return 0;
}
topcool99 2004-10-26
  • 打赏
  • 举报
回复
不会啊,很多情况下,还是要考虑的,如嵌入式系统里。
大家帮帮忙啦。
哈哈。
nkfish 2004-10-26
  • 打赏
  • 举报
回复
现在好像很少考虑空间了,学习一下
zxl_llx 2004-10-24
  • 打赏
  • 举报
回复
学习中,支持楼主,期待更圆满的解!!!
redview 2004-10-24
  • 打赏
  • 举报
回复
呵呵 处学着 帮不上忙啊
topcool99 2004-10-24
  • 打赏
  • 举报
回复
怎样应用?
lifan5748 2004-10-24
  • 打赏
  • 举报
回复
void getdfree(int drive, struct dfree *dfptr) 得到驱动器的剩余磁盘空间<dos.h>
void getfat(int drive, struct fatinfo *fptr) 得到磁盘驱动器的信息
drive 驱动器号: 1 - A盘,2 - B盘,以此类推

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧