2012-12-04 27 views

回答

0

看起來並不是一個簡單的方法來準確獲得創建時間,但您可以獲取上次修改,上次訪問和上次狀態更改的時間。

您需要使用在sys/stat.h中定義的structure statHere is the documentation關於如何獲得和使用這個結構。

7

How do I get the date a file was last modified?

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 

4.8 File Times Update

在Linux中:與文件相關聯的三個不同的時間戳:

  • 時間的內容(atime)最後訪問,
  • 時間的最後修改的內容(mtime),
  • 和時間o f inode的最後修改(元數據,ctime)。

所以,不,你不能查找文件的創建時間。 (reference)。與你一些有用的鏈接問題:

相關問題