1,常见的7种文件
(1)- 文本文件 : 文件中的内容由文本构成
(2)- 二进制文件 :存的数字不是文字编码数字,而是真正的数字
(3)d 目录文件
(4)c 字符设备文件 和 b块设备文件 :设备文件,并不是真实存在硬盘上的一个文件,而是文件系统虚拟制造出来的
(5)p 管道文件
(6)s 套接字文件 : 用来上网的
(7)l 符号链接文件
2,常用的文件属性获取API,stat、fstat、lstat
int stat(const char *pathname, struct stat *statbuf);
int fstat(int fd, struct stat *statbuf);
int lstat(const char *pathname, struct stat *statbuf);
返回值:On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
成功返回0,失败返回 -1 并设置errno。