Click to See Complete Forum and Search --> : GetFileAttributesEx() small issue


Dody
September 16th, 2006, 02:57 PM
I have kinda problem with my following code:


WIN32_FILE_ATTRIBUTE_DATA data;
GET_FILEEX_INFO_LEVELS fInfoLevelId = GetFileExInfoStandard;
GetFileAttributesEx("C:\\afile.txt", fInfoLevelId, &data);
SYSTEMTIME times, stLocal;
FileTimeToSystemTime(&data.ftLastAccessTime, &times);
SystemTimeToTzSpecificLocalTime(NULL, &times, &stLocal);
CString tim;
tim.Format("%02d", stLocal);
MessageBox(tim);


anyone can see why it is not showing the correct local time?

thanks in advance!

golanshahar
September 16th, 2006, 04:15 PM
stLocal is a structure this is how you should do it:


CString tim;
tim.Format("%02d/%02d/%04d %02d:%02d:%02d", stLocal.wDay , stLocal.wMonth, stLocal.wYear, stLocal.wHour, stLocal.wMinute, stLocal.wSecond);
MessageBox(tim);


Cheers

Dody
September 16th, 2006, 05:16 PM
thansk alot, I tried your method before and gav me a wierd output, but it is working fine now, thanks once again

golanshahar
September 16th, 2006, 05:36 PM
You are welcome :wave:

Cheers