相关函数:stat, lstat, chmod, chown, readlink, utime

头文件:#include <sys/stat.h> #include <unistd.h>

定义函数:int fstat(int fildes, struct stat *buf);

函数说明:fstat()用来将参数fildes 所指的文件状态, 复制到参数buf 所指的结构中(struct stat). Fstat()与stat()作用完全相同, 不同处在于传入的参数为已打开的文件描述词. 详细内容请参考stat().

返回值:执行成功则返回0, 失败返回-1, 错误代码存于errno.

范例
#include <sys/stat.h>
#include <unistd.h>
#include <fcntk.h>
main()
{
struct stat buf;
int fd;
fd = open("/etc/passwd", O_RDONLY);
fstat(fd, &buf);
printf("/etc/passwd file size +%d\n ", buf.st_size);
}
执行:
/etc/passwd file size = 705

最新文章

  1. 初学者--bootstrap(六)组件中的下拉菜单----在路上(10)
  2. Sprint(第十一天11.24)
  3. SQLServer存储过程和触发器学习记录及简单例子
  4. IE下默认TD colspan rowspan值为1
  5. 详细安装ss的过程(vultr)
  6. Bootstrap 图标菜单按钮组件
  7. 超强vim配置
  8. ie7下 滚动条内容不动问题
  9. LeetCode Contains Duplicate (判断重复元素)
  10. codeforces 336C Vasily the Bear and Sequence(贪心)
  11. CSS中的特殊性、继承、层叠
  12. C语言,realloc
  13. Hadoop入门进阶步步高(五)-搭建Hadoop集群
  14. spring学习总结一----控制反转与依赖注入
  15. 用户登录(Material Design + Data-Binding + MVP架构模式)实现
  16. 外部地址访问xampp
  17. Ffmpeg简介
  18. ThreadLocal(线程绑定)
  19. JavaScript之DOM对象获取(1)
  20. Scala - 快速学习07 - 模式匹配

热门文章

  1. 前端 javascript 定时器
  2. GlusterFS部署
  3. Spring第八发—自动装配及让Spring自动扫描和管理Bean
  4. Spring第四弹—–Spring的三种实例化bean的方式
  5. MySQL整理(一)
  6. Oracle记录登录失败的触发器
  7. 阿里云搭建go开发环境
  8. Git-从远程仓库克隆
  9. Ubuntu16.04双网卡配置,内网外网同时访问
  10. Js 将 Date 转化为指定格式的String