[C++] 纯文本查看 复制代码
#include "stdafx.h"
DWORD ChangeTime (PFILETIME lptime)
{
FILETIME ftLocal; //文件时间结构
SYSTEMTIME st; //系统时间结构
FileTimeToSystemTime(lptime, &st);
_tprintf (TEXT("%4d年%2d月%2d日 %2d:%2d:%2d\n"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL, "chs");
WIN32_FILE_ATTRIBUTE_DATA wfad;
if (!GetFileAttributesEx(argv[1], GetFileExInfoStandard, &wfad)) {
_tprintf (TEXT("获取文件属性错误:%d\n"), GetLastError());
return (-1);
}
ChangeTime (&wfad.ftCreationTime);
return 0;
}