fstat()
来源:互联网 发布:罂粟壳 淘宝 编辑:程序博客网 时间:2024/05/17 05:16
fstat(由文件描述词取得文件状态),相关函数 stat,lstat,chmod,chown,readlink,utime。
- 中文名
- fstat
- 定 义
- 由文件描述词取得文件状态
- 相关函数
- stat,lstat,chmod
- 返回值
- 执行成功则返回0
目录
- 1定义和用法
- 2语法
- 3说明
- 4提示和注释
- 5例子
- 6Linux fstat
- ▪定义
- ▪语法
定义和用法
编辑fstat(由文件描述词取得文件状态)
相关函数 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。
语法
编辑fstat(file)
参数
描述
pipe
必需。规定要检查的打开文件。
说明
编辑获取由文件指针 handle 所打开文件的统计信息。
该函数返回的数组具有该文件的统计信息,该数组包含以下元素:
数字下标
关联键名(自 PHP 4.0.6)
说明
0
dev
设备名
1
ino
号码
2
mode
inode 保护模式
3
nlink
被连接数目
4
uid
所有者的用户 id
5
gid
所有者的组 id
6
rdev
设备类型,如果是 inode 设备的话
7
size
文件大小的字节数
8
atime
上次访问时间(Unix 时间戳)
9
mtime
上次修改时间(Unix 时间戳)
10
ctime
上次改变时间(Unix 时间戳)
11
blksize
文件系统 IO 的块大小
12
blocks
所占据块的数目
提示和注释
编辑提示:本函数与 stat() 函数相似,不同的是,它是作用于已打开的文件指针而不是文件名。
例子
编辑<?php
$file = fopen("test.txt","r");
print_r(fstat($file));
fclose($file);
?>
输出类似:
Array ( [0] => 0 [1] => 0 [2] => 33206 [3] => 1 [4] => 0 [5] => 0 [6] => 0 [7] => 92 [8] => 1141633430 [9] => 1141298003 [10] => 1138609592 [11] => -1 [12] => -1 [dev] => 0 [ino] => 0 [mode] => 33206 [nlink] => 1 [uid] => 0 [gid] => 0 [rdev] => 0 [size] => 92 [atime] => 1141633430 [mtime] => 1141298003 [ctime] => 1138609592 [blksize] => -1 [blocks] => -1 )
PHP Filesystem 函数
Linux fstat
编辑定义
#include<unistd.h>
#include<sys/stat.h>
#include<sys/types.h>
int fstat(int fd, struct stat *buf);
语法
fstat(fd, &buf)
参数 描述
fd 必需,规定要检查的打开文件的文件描述符。
buf 必需,是struct stat结构体类型的变量
提示:本函数与 stat() 函数相似,不同的是,它是作用于已打开的文件的文件描述符而不是文件名。
0 0
- fstat
- fstat
- fstat()
- fstat函数
- fstat函数
- fstat函数
- fstat()函数
- fstat函数
- fstat函数
- fstat/stat/lstat
- stat/fstat/lstat函数
- fstat/stat系统调用
- linux_Small0318 fstat get length
- fstat stat lstat
- stat, fstat, lstat 函数
- stat/fstat/lstat 区别
- stat、fstat、lstat函数
- stat和fstat函数
- eclipse 创建 3.0的dynamic web project,servlet时的路径问题
- iOS 中的MVC,MVP,MVVM以及VIPER架构
- CrackingtheCodeInterview之C与C++
- javascript之navigator对象
- Class path contains multiple SLF4J bindings
- fstat()
- 【JZOJ 4597】现世斩
- js实现各种常用排序算法
- HBase - BloomFilter(布隆过滤器)
- 蓝牙开发笔录《一》
- 快排序
- python学习——条件判断
- sqoop遇到的问题
- 2552: 小朋友的数字