linux C复习:文件操作(stat获取文件属性)
来源:互联网 发布:淘宝详情页尺寸是多少 编辑:程序博客网 时间:2024/05/19 00:56
#include <sys/stat.h>#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <time.h>typedef struct stat ST;int main(){ //准备结构体 ST s; //调用stat函数 int res = stat("a.txt",&s); if(-1 == res) perror("error:"),exit(-1); printf("inode = %d\n",s.st_ino); printf("mode = %o\n",s.st_mode&07777); printf("hard = %d\n",s.st_nlink); printf("uid = %d\n",s.st_uid); printf("size = %d\n",s.st_size); printf("blocksize = %d\n",s.st_blksize); printf("blocks = %d\n",s.st_blocks); printf("atime = %s",ctime(&s.st_atime)); //使用宏函数检查文件属性 if(S_ISDIR(s.st_mode)) puts("文件夹"); if(S_ISREG(s.st_mode)) puts("普通文件");}
0 0
- linux C复习:文件操作(stat获取文件属性)
- Linux stat 获取文件属性
- Linux stat函数获取文件属性(文件大小,创建时间等)
- stat.h头文件,轻松获取文件属性
- stat.h头文件,轻松获取文件属性
- stat.h头文件,轻松获取文件属性
- Linux文件属性2——使用stat函数获取文件属性
- 获取文件属性-fstat/stat
- Linux C获取文件属性
- 文件操作--设置文件属性、获取文件属性
- stat.h头文件,轻松获取文件属性(2…
- stat.h头文件,轻松获取文件属性(2…
- OC文件操作、获取文件属性
- linux stat函数(获取文件详细信息)
- 【Linux学习笔记】获取文件属性 — stat()、fstat()、lstat()小结
- 【Linux学习笔记】获取文件属性 — stat()、fstat()、lstat()小结
- 【Linux学习笔记】获取文件属性 — stat()、fstat()、lstat()小结
- Linux获取文件属性stat()、fstat()、lstat()函数实例学习
- 使用Jquery+EasyUI 进行框架项目开发案例讲解
- php curl 添加cookie伪造登陆抓取数据
- VisionMobile:2014年Q3移动开发者经济报告(七):6、游戏开发者国度的情况
- 使用Dom4j解析xml文件---SAXReader方式
- java 正则表达式
- linux C复习:文件操作(stat获取文件属性)
- 封装系统JSON解析(YHJSONSerialization),适合IOS 5.0以上
- HDU 1249 三角形 数论
- 几种ARM反汇编器
- 汇编代码注入器
- python with 语句的实例用法 & 高级用法:
- ORACLE PL/SQL编程之八: 把触发器说透
- css基础(二)IE CSS Bugs 列表和解决方法
- android camera(一):camera模组CMM介绍