免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1640 | 回复: 9
打印 上一主题 下一主题

UNIX下如何用C编程显示硬盘可用空间? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-04-25 17:09 |只看该作者 |倒序浏览
在UNIX系统下用C语言编程,能不能象在WINDOWS中可以通过调用getdfree函数,显示硬盘可用空间?请教各位高手指点,谢谢!

论坛徽章:
0
2 [报告]
发表于 2005-04-26 08:46 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

system("dk"

论坛徽章:
0
3 [报告]
发表于 2005-04-26 09:54 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

还不明白的话,就看dk的实现code!

论坛徽章:
0
4 [报告]
发表于 2005-04-26 11:01 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

dk是个什么命令
是不是df

论坛徽章:
0
5 [报告]
发表于 2005-04-26 12:26 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

是df
hu-unIX也可以是bdf,或df 他们显示出来结果可能差一点,

论坛徽章:
0
6 [报告]
发表于 2005-04-26 16:18 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

This  manual  page  documents  the  GNU version of df.  df displays the
       amount of disk space available on the filesystem containing  each  file
       name  argument.   If  no file name is given, the space available on all
       currently mounted filesystems is shown.  Disk  space  is  shown  in  1K
       blocks  by  default, unless the environment variable POSIXLY_CORRECT is
       set, in which case 512-byte blocks are used.

       If an argument is the absolute file name of a disk device node contain-
       ing a mounted filesystem, df shows the space available on that filesys-
       tem rather than on the filesystem containing the device node (which  is
       always  the root filesystem).  This version of df cannot show the space
       available on unmounted filesystems, because on most  kinds  of  systems
       doing  so  requires  very  nonportable intimate knowledge of filesystem
       structures.

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
7 [报告]
发表于 2005-04-26 16:20 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

原帖由 "henngy" 发表:
This  manual  page  documents  the  GNU version of df.  df displays the
       amount of disk space available on the filesystem containing  each  file
       name  argument.   If  no file name is gi..........


没有mount的磁盘不能检测到容量.这确实是df的局限性..

论坛徽章:
0
8 [报告]
发表于 2005-04-26 16:30 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

还是因为 linux unix的文件系统格式比较特殊,不同于win的fat32,nfs一类的

论坛徽章:
0
9 [报告]
发表于 2005-04-26 16:56 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

man statfs

论坛徽章:
0
10 [报告]
发表于 2005-04-26 17:09 |只看该作者

UNIX下如何用C编程显示硬盘可用空间?

呵呵
真的有
多谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP