PRB: CFile::SetStatus Sets Archive Bit when Not DesiredLast reviewed: July 22, 1997Article ID: Q117832 |
7.00 | 1.00 1.50
MS-DOS | WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSAttempting to clear the archive bit of a file when the archive bit is already cleared causes the archive bit to be set.
CAUSEThis is expected behavior that results when the m_mtime member of the CFileStatus structure is not set to 0, indicating that the time should be updated. Because updating the time has the side effect of setting the archive bit for a file, this action takes precedence over clearing the archive bit when the bit was clear to begin with.
RESOLUTION
MORE INFORMATIONTo duplicate this behavior, create a test file called TEMP.DAT and run the sample code below:
Sample Code
// Using the MS-DOS ATTRIB command, watch the archive bit toggle // after each time you run the program. #define _DOS #include <afx.h> CFileStatus fs; void main(void) { CFile::GetStatus("TEMP.DAT",fs); fs.m_attribute = fs.m_attribute & !CFile::archive; CFile::SetStatus("TEMP.DAT",fs); }This behavior does not occur with Visual C++ 32-bit Edition.
REFERENCESThe possible side effects of m_mtime on file attributes are discussed in the "Class Library Reference" for Visual C++, version 1.5, page 411.
|
Additional reference words: 7.00 1.00 1.50 2.00 2.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |