如何在Windows中确定文件的创建日期?

5 c c++ windows winapi file

如何获取文件创建日期?我正在运行Windows.

Bil*_*eal 13

在Windows上,您应该使用GetFileAttributesEx函数.


Ars*_*yan 1

使用统计函数

这里

#include <sys/stat.h>

#include <unistd.h>

#include <time.h>



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
Run Code Online (Sandbox Code Playgroud)