Get file last write time and create time as Julian date value or as string.
BOOL get_file_time( LPCSTR lpcszFile, double * pdLastWriteTimeJulian = NULL, double * pdCreationTimeJulian = NULL, LPSTR pszLastWriteYMDHMS = NULL, LPSTR pszCreationYMDHMS = NULL )
TRUE if Success, otherwise FALSE.
EX1
//the file test.txt must exist in temp folder path void get_file_time_Ex1() { char szTemp[MAXFULLPATH]; GetTempPath(MAXFULLPATH, szTemp); // Get temp folder path. string strFile = szTemp + "\\test.txt"; double dLastWriteTime, dCreationTime; bool bFlag = get_file_time(strFile, &dLastWriteTime, &dCreationTime); if(!bFlag) printf("failed to get file's last write time"); else { out_str("the file's last write time is "+get_date_str(dLastWriteTime, LDF_SHORT_AND_HHMM_SEPARCOLON)); out_str("the file's creation time is "+get_date_str(dCreationTime, LDF_SHORT_AND_HHMM_SEPARCOLON)); } }
GetTempPath, get_date_str
origin.h