当前位置: 首页 > wzjs >正文

金坛网站建设磁力链最好用的搜索引擎

金坛网站建设,磁力链最好用的搜索引擎,软件开发和网站建设,wordpress4.8中文版1. Linux文件属性 普通文件(文本文件和二进制文件) -, regular file目录文件 d, directory字符设备文件(对应硬件设备,虚拟文件) c, char块设备文件 b, block管道文件 p, pipe套接字文件 s, socket符号链接文件 l, lin…

1. Linux文件属性

  • 普通文件(文本文件和二进制文件) -, regular file
  • 目录文件 d, directory
  • 字符设备文件(对应硬件设备,虚拟文件) c, char
  • 块设备文件 b, block
  • 管道文件 p, pipe
  • 套接字文件 s, socket
  • 符号链接文件 l, link

2. Linux获取文件属性的API

Linux获取文件属性的API也是调用stat命令实现的。

  • int stat(const char *pathname, struct stat *statbuf);
  • 直接获取文件的属性
  • int fstat(int fd, struct stat *statbuf);
  • 根据fd获取已经打开的文件的属性,所以是读取的动态文件属性。
  • int lstat(const char *pathname, struct stat *statbuf);
  • stat和fstat查看的符号链接文件指向的文件的属性,而lstat查看的是符号链接本身的属性。

结构体:

       struct stat {dev_t     st_dev;         /* ID of device containing file */ino_t     st_ino;         /* Inode number */mode_t    st_mode;        /* File type and mode */nlink_t   st_nlink;       /* Number of hard links */uid_t     st_uid;         /* User ID of owner */gid_t     st_gid;         /* Group ID of owner */dev_t     st_rdev;        /* Device ID (if special file) */off_t     st_size;        /* Total size, in bytes */blksize_t st_blksize;     /* Block size for filesystem I/O */blkcnt_t  st_blocks;      /* Number of 512B blocks allocated *//* Since Linux 2.6, the kernel supports nanosecondprecision for the following timestamp fields.For the details before Linux 2.6, see NOTES. */struct timespec st_atim;  /* Time of last access */struct timespec st_mtim;  /* Time of last modification */struct timespec st_ctim;  /* Time of last status change */#define st_atime st_atim.tv_sec      /* Backward compatibility */#define st_mtime st_mtim.tv_sec#define st_ctime st_ctim.tv_sec};st_mode是一个按位定义的文件类型标志,可以用
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FILE "a.txt"
int main(void)
{int ret = -1;struct stat buf;memset(buf, 0, sizeof(buf));ret = stat(FILE, &buf);if (ret < 0){perror("stat");exit(-1);}printf("inode = %d. \n",buf.st_ino);int res = S_ISREG(buf.st_mode);return 0;
}
  • int access(const char *pathname, int mode);
  • 测试当前环境下当前用户对此文件是否有权限。
int ret = -1;
ret = access(FILE, F_OK);
if (ret < 0)
{printf("Not exist");
}
else
{printf("Exist");
}
  • DIR *opendir(const char *name);
  • opendir打开一个目录后得到一个DIR类型的指针给readdir使用
  • struct dirent *readdir(DIR *dirp);

readdir函数调用一次就会返回一个struct dirent类型的指针,这个指针指向一个结构体变量,这个结构体变量里面记录了一
个目录项(所谓目录项就是目录中的一个子文件)。

http://www.dtcms.com/wzjs/9467.html

相关文章:

  • 网站定制开发什么意思网址seo优化排名
  • 网站的层级百度引擎搜索网址
  • vue 做门户网站站长工具搜索
  • 地情网站建设可以免费发布广告的平台有哪些
  • 一级a做爰片免费网站国产推广计划方案模板
  • wordpress文章表单镇江seo
  • 网站换稳定服务器重庆森林经典台词图片
  • 常用网站搜索引擎天津网站seo设计
  • 政府网站如何建设湖北seo
  • 国外网站做问卷中国时事新闻网
  • 政府网站制作费用手机app安装下载
  • 郑州网站改版志鸿优化网官网
  • 巧家县住房和城乡建设局网站昆山网站建设公司
  • 杭州网站seo推广软件百度百度网址大全
  • 天津建设电工证查询网站百度营销搜索推广
  • 做爰全过程免费网站的视频郑州网站推广技术
  • 1cpu0.5g服务器用来做网站会计培训机构
  • 国务院建设主管部门网站哈尔滨百度公司地址
  • 济南网站建设套餐网络营销的目的和意义
  • 无聊网站建设产品软文范例大全
  • 做瞹瞹视频电影邪恶网站seo搜索引擎优化是什么
  • 村级网站建站广州网站快速排名
  • wordpress主题cute网络推广seo
  • wordpress微信关注查看朝阳网站seo
  • 帝国cms网站迁移热门推广平台
  • 邵阳做网站的有哪些域名解析网站
  • 东莞手机网站制作引流客户的最快方法是什么
  • 化工课设代做网站论文收录网站排名
  • 企业所得税税率2022年最新税率表谷歌seo搜索引擎优化
  • 西宁市网站建设价格app推广软件