CArchiveException::m_cause

Syntax

int m_cause;

Remarks

Specifies the cause of the exception. Its values are defined by a CArchiveException enumerated type. The enumerators are:

Value Meaning

CArchiveException::none No error occurred.
CArchiveException::generic Unspecified error.
CArchiveException::readOnly Tried to write into an archive opened for loading.
CArchiveException::endOfFile Reached end of file while reading an object.
CArchiveException::writeOnly Tried to read from an archive opened for storing.
CArchiveException::badIndex Invalid file format.
CArchiveException::badClass Tried to read an object into an object of the wrong type.
CArchiveException::badSchema Tried to read an object with a different version of the class.

Note:

These CArchiveException cause enumerators are distinct from the CFileException cause enumerators.

Example

extern CFile f;

TRY

{

CArchive ar( &f, CArchive::store );

}

CATCH( CArchiveException, e)

{

if( e->m_cause == CArchiveException::readOnly )

printf( "ERROR: Archive is read-only\\n" );

}

END_CATCH