gpt4 book ai didi

C++:如何修改文件 'created' 时间戳?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:08:56 30 4
gpt4 key购买 nike

我需要修改文件的“创建”(如果存在)、“修改”和“访问”时间戳。理想情况下,这将是一个独立于平台的解决方案。

我查看了 boost 库,但没有看到任何相关内容。我发现最接近的相关内容是 this适用于 Windows。

有人可以帮忙吗?谢谢。

最佳答案

我从未使用过它们,但我猜你正在寻找属性函数:
http://www.boost.org/doc/libs/1_44_0/libs/filesystem/v2/doc/reference.html#Attribute-functions

还有最后修改的函数:

template <class Path> std::time_t last_write_time(const Path& p);
template <class Path> void last_write_time(const Path& p, const std::time_t new_time);

关于C++:如何修改文件 'created' 时间戳?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3814349/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com