c++ 获取文件创建时间、修改时间、访问时间、文件内容长度

int GetFileInfo(string& strPath, int& iCreateTime, int& iModifyTime, int& iAccessTime, int& iFileLen)
{
  struct _stat tmpInfo;
  if (_stat(strPath.c_str(), &tmpInfo) != 0)
  {
    return FALSE;
  }
  iCreateTime = static_cast<int>(tmpInfo.st_ctime);
  iModifyTime = static_cast<int>(tmpInfo.st_mtime);
  iAccessTime = static_cast<int>(tmpInfo.st_atime);
  iFileLen = static_cast<int>(tmpInfo.st_size);

  return TRUE;
}

原文链接: https://www.cnblogs.com/longma8586/p/13849223.html

欢迎关注

微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍

    c++ 获取文件创建时间、修改时间、访问时间、文件内容长度

原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/204161

非原创文章文中已经注明原地址,如有侵权,联系删除

关注公众号【高性能架构探索】,第一时间获取最新文章

转载文章受原作者版权保护。转载请注明原作者出处!

(0)
上一篇 2023年2月12日 下午9:46
下一篇 2023年2月12日 下午9:46

相关推荐