【发布时间】:2018-07-20 05:52:01
【问题描述】:
我需要 modification time、creation time 和 change time 使用 cpp 在 windows 中的文件。我正在使用以下代码:
string filename = "D:\\hi.txt";
struct stat result;
if (stat(filename.c_str(), &result) == 0)
{
int a = 10;
auto mod_time = result.st_mtime;
cout << "modified time is: "<<mod_time<<endl;
}
使用它我可以获得modification 和creation time。但是,我无法为该文件获取change time。我应该如何使用 cpp 获取 change time 文件?
“变化时间”的定义如下。
随着文件内容的改变和修改时间的改变 即使文件的属性发生变化,更改时间也会发生变化 访问权限。
【问题讨论】:
-
考虑到 Windows 没有 Linux 拥有的相同权限位集,那么更改时间意味着什么?
标签: c++ windows filesystems stat