Partager via


CArchive::Abort

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

void Abort ( );

Remarks

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.

Example

See the example for CArchive::WriteClass.

Requirements

Header: afx.h

See Also

Reference

CArchive Class

Hierarchy Chart

CArchive::Close

CFile::Close