【发布时间】:2011-09-22 15:36:53
【问题描述】:
我想检索文件的最后写入日期。我已经为它编写了这段代码,但它总是以“年”之类的值返回 52428
int LastErrorCode;
LPCSTR Path = "C:/Users/Username/Desktop/Picture.PNG";
WIN32_FIND_DATA Information;
if(!FindFirstFile(Path, &Information))
{
int LastErrorCode = GetLastError();
cout << "FIND FIRST FILE FAILED" << endl;
cout << LastErrorCode << endl;
}
SYSTEMTIME MyTime;
FILETIME MyFileTime = Information.ftLastWriteTime;
if(!FileTimeToSystemTime(&MyFileTime, &MyTime))
{
LastErrorCode = GetLastError();
cout << "FILE TIME TO SYSTEM TIME FAILED" << endl;
cout << LastErrorCode << endl;
}
cout << MyTime.wYear << endl;
【问题讨论】:
标签: c++ winapi systemtime