用fstat()或stat()函数试试。
#include <sys/stat.h>
#include <unistd.h>
int fstat(int filefes,struct stat *buf);
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *file_name,struct stat *buf);
其中struct stat中有三个字段可以用:
struct stat
{
...
time_t st_atime; //time of last access
time_t st_mtime; //time of last modification
time_t st_ctime; //time of last change
};