hi, im curious of how to retieve windows created, last accessed and modified times and dates from files on the windows OS. At the mintue i am streaming from my files reading data and so on but i think it would be useful to retrieve the dtes and times for these files as well.
Ive been having a look around and i think i need something like 'filetimetosystemtime' but im not sure if this is the one? I think they use FILETIME and SYSTEMTIME but im not really familiar with using these funtions, does anyone know any good sites for research on this topic?
any advice would be appreciated
Originally Posted by pastitprogram
thanks, been browsing the msdn website and seem to have found somthing very usefull! Not totaly sure i fully understand what it is trying to tell me but i think it is definatly of use!
I think i understand the basic jist of things but im not sure how to get a 'handle' on my file that i am examining and want to retrieve the time and date from? I think will cause me a lot of trouble i think
HANDLE hFile; // file handle?
FILETIME ftCreate, ftAccess, ftWrite; // variables for storing dates?
SYSTEMTIME stUTC, stLocal; // Not sure
GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite)) // I think this is retrieving the times from the file handle hFile
FileTimeToSystemTime(&ftWrite, &stUTC); //conversion to time?
cout << stLocal.wMonth, stLocal.wDay, stLocal.wYear,
stLocal.wHour, stLocal.wMinute; //printing out the date?
You get a handle to the file by calling CreateFile().
I'm not sure if _fileno() will also return a WIN32 handle, or if it's some other implementation of "handle".