Cでファイルの作成日を取得するにはどうすればよいですか?私は機能getFileTime
を参照してくださいが、私は私が作成時間を返すためにそれを使用できるかわからない:ファイルの作成日を返すにはどうすればよいですか?
BOOL WINAPI GetFileTime(
__in HANDLE hFile, // handle to the file
__out_opt LPFILETIME lpCreationTime, // FILETIME struct for creation time
__out_opt LPFILETIME lpLastAccessTime, // FILETIME struct for last access time
__out_opt LPFILETIME lpLastWriteTime // FILETIME struct for last modification time
);
//私は1601年1月1日を返し、それを仕事ONTこの1が、ドールを行います。私はありません日付の変更
HANDLE h_fichier;
LPCWSTR fname = L"C:\\Program Files (x86)\\IE tn-Sign\\tn-Sign-plugin- ie.dll";
FILETIME date_fichier_tmp;
SYSTEMTIME date_fichier_utc, date_fichier_local;
//Ouverture du fichier
h_fichier = CreateFile(fname,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(h_fichier == INVALID_HANDLE_VALUE)
printf("CreateFile ko %S\n", fname);
EstEID_log("CreateFile ko %S\n", fname);
//Date de modification du fichier
if (!GetFileTime(h_fichier, NULL, NULL, &date_fichier_tmp))
printf("GetFileTime ko\n");
EstEID_log("GetFileTime ko\n");
//Convertion de la date
FileTimeToSystemTime(&date_fichier_tmp, &date_fichier_utc);
SystemTimeToTzSpecificLocalTime(NULL, &date_fichier_utc, &date_fichier_local);
printf("Derniere modification le %02d-%02d-%d %02dh%02d\n", date_fichier_local.wDay, date_fichier_local.wMonth, date_fichier_local.wYear, date_fichier_local.wHour, date_fichier_local.wMinute);
EstEID_log("Derniere modification le %02d-%02d-%d %02dh%02d\n", date_fichier_local.wDay, date_fichier_local.wMonth, date_fichier_local.wYear, date_fichier_local.wHour, date_fichier_local.wMinute);
//Fermeture du fichier
CloseHandle(h_fichier);
system("pause");
return 0;
[mcve]を入力してください。 – IInspectable