CFile::SetStatus
This documentation is archived and is not being maintained.

CFile::SetStatus 

Sets the status of the file associated with this file location.


static void PASCAL SetStatus(
   LPCTSTR lpszFileName,
   const CFileStatus& status 
);

Parameters

lpszFileName

A string that is the path to the desired file. The path can be relative or absolute, and can contain a network name.

status

The buffer containing the new status information. Call the GetStatus member function to prefill the CFileStatus structure with current values, then make changes as required. If a value is 0, then the corresponding status item is not updated. See the GetStatus member function for a description of the CFileStatus structure.

To set the time, modify the m_mtime field of status.

Please note that when you make a call to SetStatus in an attempt to change only the attributes of the file, and the m_mtime member of the file status structure is nonzero, the attributes may also be affected (changing the time stamp may have side effects on the attributes). If you want to only change the attributes of the file, first set the m_mtime member of the file status structure to zero and then make a call to SetStatus.

//example for CFile::SetStatus
char* pFileName = "test.dat";
extern BYTE newAttribute;
CFileStatus status;
CFile::GetStatus( pFileName, status );
status.m_attribute = newAttribute;
CFile::SetStatus( pFileName, status );
Show:
© 2016 Microsoft