c++ 获取文件修改时间

来源:互联网 发布:游族网络能涨到多少 编辑:程序博客网 时间:2024/05/18 20:12
SYSTEMTIME OnTime64toSystemTime(__time64_t& itime){struct tm *temptm = _localtime64(&itime);SYSTEMTIME st = {1900 + temptm->tm_year, 1 + temptm->tm_mon, temptm->tm_wday, temptm->tm_mday, temptm->tm_hour, temptm->tm_min, temptm->tm_sec, 0};return st;}void GetModifyDateTime(const wstring& strFilename, SYSTEMTIME& stLocal){struct _stat64i32 statbuf; _wstat64i32(strFilename.c_str(), &statbuf);stLocal = OnTime64toSystemTime(statbuf.st_mtime);}


调用:

SYSTEMTIME stLocal;GetModifyDateTime(L"E:\\123.dx", stLocal);


原创粉丝点击