在 C 中使用 utime 获取 UNIX 上的文件修改时间
一位教授告诉我,您可以使用utime.h获取文件的最后修改时间。然而,手册页似乎引用了 utime() 仅设置此值。如何在 UNIX 系统上的 C 语言中查找文件上次更改的时间?
I have been told by a professor that you can get a file's last modification time by using utime.h. However, the man page seem to cite that utime() only sets this value. How can I look up the last time a file was changed in C on a UNIX system?
这将返回文件的mtime,即“上次数据修改的时间”。请注意,Unix 也有一个概念ctime ,“上次状态更改的时间”(另请参阅 ctime、atime、mtime )。
This returns the file's mtime, the "time of last data modification". Note that Unix also has a concept ctime, the "time of last status change" (see also ctime, atime, mtime).