struct stat attrib; //1. create a file attribute structure
stat("file_name", &attrib); //2. get the attributes of afile.txt
clock = gmtime(&(attrib.st_mtime)); //3. Get the last modified time and
// put it into the time structure
Run Code Online (Sandbox Code Playgroud)
在Linux中:与文件关联的三个不同时间戳:
- 上次访问内容的时间(
atime),- 上次修改内容的时间(
mtime),- 和最后一次修改inode的时间(元数据
ctime).
所以,不,你不能找到文件的创建时间.(参考).一些与您有关的有用链接问题:
| 归档时间: |
|
| 查看次数: |
9313 次 |
| 最近记录: |