MFC Help Contradiction
11-Jul-94 22:45:26
Sb: #30464-MFC Help Contradiction
Fm: Gary Capps 74634,3377
To: Justin Grant 71062,2162
JG> I believe that I have found a contradiction in the
JG> documentation of CFile, regarding whether destroying an
JG> open CFile will cause the associated operating system file
JG> to be closed.
JG>
JG> Which one is right?
They both are :). Actually, if the ctor CFile::CFile( int hFile ) is used (in
other words, a CFile object is attached to an existing open file),
CFile::~CFile() will *not* close it. Otherwise, if the file is opened by
CFile::Open(), it *will* be closed by the dtor. (Check out the source file
FILECORE.CPP and note the m_bCloseOnDelete member of CFile).
gc
Norman, Oklahoma USA
— "Is that a *real* poncho or is that a *Sears* poncho?"