代码之家  ›  专栏  ›  技术社区  ›  Ben L

C++:如何修改文件创建的时间戳?

  •  5
  • Ben L  · 技术社区  · 14 年前

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

    我看过Boost库,但没看到任何相关的东西。我找到的最接近相关的东西是 this 对于Windows。

    有人能帮忙吗?谢谢。

    4 回复  |  直到 14 年前
        1
  •  7
  •   Daniel    14 年前


    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);
    
        2
  •  2
  •   Ben L    14 年前
        3
  •  1
  •   Richard Cook    14 年前