How can I determine a file's creation date in Windows?

后端 未结 4 1868
一个人的身影
一个人的身影 2021-01-13 02:08

How can I get the date of when a file was created? I am running Windows.

4条回答
  •  感情败类
    2021-01-13 02:57

    Use stat function

    see here

    #include 
    
    #include 
    
    #include 
    
    
    
    struct tm* clock;               // create a time structure
    
    struct stat attrib;         // create a file attribute structure
    
    stat("afile.txt", &attrib);     // get the attributes of afile.txt
    
    clock = gmtime(&(attrib.st_mtime)); // Get the last modified time and put it into the time structure
    

提交回复
热议问题