Re: Файлы
От: aid2003  
Дата: 22.03.05 20:05
Оценка:
Здравствуйте, Ched, Вы писали:

C>Как сделать проверку последней модификации 2 файлов. Т.е. если не

C>равна то что то делать. Пробовал через CFile::GetStatus но не
C>получается. Как то непонятно он показывает время.


функция GetFileTime, пример из МСДН



// GetLastWriteTime - retrieves the last-write time and converts the
//                   time to a string
// Return value - TRUE if successful, FALSE otherwise
// hFile      - must be a valid file handle
// lpszString - pointer to buffer to receive string

BOOL GetLastWriteTime(HANDLE hFile, LPSTR lpszString)
{
    FILETIME ftCreate, ftAccess, ftWrite;
    SYSTEMTIME stUTC, stLocal;

    // Retrieve the file times for the file.
    if (!GetFileTime(hFile, &ftCreate, &ftAccess, &ftWrite))
        return FALSE;

    // Convert the last-write time to local time.
    FileTimeToSystemTime(&ftWrite, &stUTC);
    SystemTimeToTzSpecificLocalTime(NULL, &stUTC, &stLocal);

    // Build a string showing the date and time.
    wsprintf(lpszString, "%02d/%02d/%d  %02d:%02d",
        stLocal.wDay, stLocal.wMonth, stLocal.wYear,
        stLocal.wHour, stLocal.wMinute);

    return TRUE;
}


Хендл к файлу можно получить с пом. функции CreateFile.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.