To change the last-modified time of a file?
-
I want to change the modified time of a file by giving year,month..etc as input.To use SetFileTime() we need ptr to FILETIME structure.I am able to change the modified time to the current time by taking the systemtime.But facing problem to change to other input time.Please help...Thanks.
-
I want to change the modified time of a file by giving year,month..etc as input.To use SetFileTime() we need ptr to FILETIME structure.I am able to change the modified time to the current time by taking the systemtime.But facing problem to change to other input time.Please help...Thanks.
Monisankar wrote: I want to change the modified time of a file...I am able to change the modified time So what is it that you are having troubles with? Perhaps a code snippet of what you are doing, and the results it is producing, is in order.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
I want to change the modified time of a file by giving year,month..etc as input.To use SetFileTime() we need ptr to FILETIME structure.I am able to change the modified time to the current time by taking the systemtime.But facing problem to change to other input time.Please help...Thanks.
// Set system time to 31-Jan-1959 5:30am
SYSTEMTIME st;
ZeroMemory (&st, sizeof (st));
st.wYear = 1959;
st.wMonth = 1;
st.wDay = 31;
st.wHour = 5;
st.wMinute = 30;// Convert the system time to a file time
FILETIME ft;
VERIFY (SystemTimeToFileTime (&st, &ft));// Set the file's modification time
VERIFY (SetFileTime (hFile, NULL, NULL, &ft));/ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com