C++获得文件的大小,日期等属性
该怎么编呢? 问题点数:50、回复次数:8Top
1 楼pi1ot(-=\Pilot/=-)回复于 2002-06-13 20:04:40 得分 10
unix下是 stat()
man stat.Top
2 楼qxp()回复于 2002-06-13 20:46:05 得分 5
stat, fstat 都行,
Top
3 楼linhui(白鸽)回复于 2002-06-13 21:11:24 得分 5
upTop
4 楼slight(slight)回复于 2002-06-14 11:54:45 得分 0
windows 下呢Top
5 楼slight(slight)回复于 2002-06-14 11:55:07 得分 0
windows 下呢Top
6 楼chenqing1128(Alex)回复于 2002-06-14 12:14:43 得分 0
关注Top
7 楼huangwu007(浪迹天涯)回复于 2002-06-14 12:50:40 得分 5
windows 下也是fstatTop
8 楼huangwu007(浪迹天涯)回复于 2002-06-17 09:27:23 得分 25
FILE* file = fopen(...)
struct stat buf;
fstat(file->_file , buf);
The stat structure, defined in SYS\STAT.H, contains the following fields:
st_atime
Time of last file access.
st_ctime
Time of creation of file.
st_dev
If a device, handle; otherwise 0.
st_mode
Bit mask for file-mode information. The _S_IFCHR bit is set if handle refers to a device. The _S_IFREG bit is set if handle refers to an ordinary file. The read/write bits are set according to the file’s permission mode. _S_IFCHR and other constants are defined in SYS\STAT.H.
st_mtime
Time of last modification of file.
st_nlink
Always 1 on non-NTFS file systems.
st_rdev
If a device, handle; otherwise 0.
st_size
Size of the file in bytes.Top




