본문 바로가기

Windows/MFC

file attribute

[code]
//misc. file
CString filename = _T("test.dat");
CFileStatus fileStatus;

//read information
CFile::GetStatus(filename,fileStatus);

//change last access date
CTime lastAccess = fileStatus.m_atime;
//modify (new date/time : 10:10:10, 1989-12-12)
lastAccess = CTime(1989,12,12,10,10,10);

//m_mtime must always be changed
fileStatus.m_mtime = lastAccess;
//change access date too and noone will notice anything ;-)
fileStatus.m_atime = lastAccess;
//as a little gimmick, we'll change the file attributes too
fileStatus.m_attribute = readOnly | hidden;

//save
CFile::SetStatus(filename,fileStatus);
[/code]

'Windows > MFC' 카테고리의 다른 글

macro  (0) 2013.10.02
error PRJ0004  (0) 2013.10.02
CreateDIBSection  (0) 2013.10.02
Foreground set 포그라운드 실행  (0) 2013.10.02
메뉴바 숨기기 Hide menu bar  (0) 2013.10.02