{ SYSTEMTIME stime;
printf(″testing for directory [%s]\n″, DirName);
if ( GetDirTime(DirName, stime) )
// 显示修改前目录的时间
printf(″before change is %04d-%02d-%02d %02d:%02d:%02d\n″,
stime.wYear , stime.wMonth , stime.wDay ,
stime.wHour , stime.wMinute, stime.wSecond );
else
printf(″failed to get the datetime of directory\n″);
stime.wYear = 1995;
stime.wMonth = 5;
stime.wDay = 12;
stime.wHour = 10 - 8; // GMT time, GMT+8 for China PRC
stime.wMinute = 11;
stime.wSecond = 12;
// GetSystemTime(&stime);
// 如果要设置成当前的时间
if ( SetDirTime(DirName, stime) )
// 修改目录的时间
printf(″success to change datetime of directory.\n″);
else
printf(″failed to change the datetime of directory\n″);
if ( GetDirTime(DirName, stime) )
// 显示修改后目录的时间
printf(″after change is %04d-%02d-%02d %02d:%02d:%02d\n″,stime.wYear , stime.wMonth , stime.wDay ,stime.wHour , stime.wMinute, stime.wSecond );
else
printf(″failed to get the datetime of directory\n″);
return 0;}
void main(int argc, char argv)
{ DoTest(″c:\\dir″);}