Export (0) Print
Expand All

CArchive::Abort

Call this function to close the archive without throwing an exception.

void Abort ( );

The CArchive destructor will normally call Close, which will flush any data that has not been saved to the associated CFile object. This can cause exceptions.

When catching these exceptions, it is a good idea to use Abort, so that destructing the CArchive object doesn't cause further exceptions. When handling exceptions, CArchive::Abort will not throw an exception on failures because, unlike CArchive::Close, Abort ignores failures.

If you used new to allocate the CArchive object on the heap, then you must delete it after closing the file.

See the example for CArchive::WriteClass.

Header: afx.h

Community Additions

ADD
Show:
© 2014 Microsoft