70,038
社区成员
发帖
与我相关
我的任务
分享
struct stat fileStat;
if(stat("example",&fileStat)==0){
//将文件状态返回到结构fileStat中
cout << fileStat.st_size ;
}else{
};
然后对fileStat结构进行比较!!
The structure stat contains at least the following members:
dev_t st_dev ID of device containing file
ino_t st_ino file serial number
mode_t st_mode mode of file (see below)
nlink_t st_nlink number of links to the file
uid_t st_uid user ID of file
gid_t st_gid group ID of file
dev_t st_rdev device ID (if file is character or block special)
off_t st_size file size in bytes (if file is a regular file)
time_t st_atime time of last access
time_t st_mtime time of last data modification
time_t st_ctime time of last status change
blksize_t st_blksize a filesystem-specific preferred I/O block size for
this object. In some filesystem types, this may
vary from file to file
blkcnt_t st_blocks number of blocks allocated for this object