Converts a system time to 64-bit file time
BOOL SystemTimeToFileTime( const SYSTEMTIME * lpSystemTime, FILETIME * lpFileTime )
If the function succeeds, the return value is true; else return false;
EX1
int SystemTimeToFileTime_ex1() { string strFileName = "c:\\test.txt"; BOOL bRet = FALSE; HANDLE hFile = CreateFile(strFileName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) { FILETIME ft; SYSTEMTIME st; GetSystemTime(&st); // gets current time SystemTimeToFileTime(&st, &ft); // converts to file time format bRet = SetFileTime(hFile,NULL, NULL, &ft); CloseHandle(hFile); } return 1; }
SetFileTime, FileTimeToSystemTime
origin.h