Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Represents a serialization exception condition
Syntax
class CArchiveException : public CException
Members
Public Constructors
| Name | Description |
|---|---|
| CArchiveException::CArchiveException | Constructs a CArchiveException object. |
Public Data Members
| Name | Description |
|---|---|
| CArchiveException::m_cause | Indicates the exception cause. |
| CArchiveException::m_strFileName | Specifies the name of the file for this exception condition. |
Remarks
The CArchiveException class includes a public data member that indicates the cause of the exception.
CArchiveException objects are constructed and thrown inside CArchive member functions. You can access these objects within the scope of a CATCH expression. The cause code is independent of the operating system. For more information about exception processing, see Exception Handling (MFC).
Inheritance Hierarchy
CArchiveException
Requirements
Header: afx.h
CArchiveException::CArchiveException
Constructs a CArchiveException object, storing the value of cause in the object.
CArchiveException(
int cause = CArchiveException::none,
LPCTSTR lpszArchiveName = NULL);
Parameters
cause
An enumerated type variable that indicates the reason for the exception. For a list of the enumerators, see the m_cause data member.
lpszArchiveName
Points to a string containing the name of the CArchive object causing the exception.
Remarks
You can create a CArchiveException object on the heap and throw it yourself or let the global function AfxThrowArchiveException handle it for you.
Do not use this constructor directly; instead, call the global function AfxThrowArchiveException.
CArchiveException::m_cause
Specifies the cause of the exception.
int m_cause;
Remarks
This data member is a public variable of type int. Its values are defined by a CArchiveException enumerated type. The enumerators and their meanings are as follows:
CArchiveException::noneNo error occurred.CArchiveException::genericExceptionUnspecified error.CArchiveException::readOnlyTried to write into an archive opened for loading.CArchiveException::endOfFileReached end of file while reading an object.CArchiveException::writeOnlyTried to read from an archive opened for storing.CArchiveException::badIndexInvalid file format.CArchiveException::badClassTried to read an object into an object of the wrong type.CArchiveException::badSchemaTried to read an object with a different version of the class.Note
These
CArchiveExceptioncause enumerators are distinct from theCFileExceptioncause enumerators.Note
CArchiveException::genericis deprecated. UsegenericExceptioninstead. If generic is used in an application and built with /clr, there will be syntax errors that are not easy to decipher.
CArchiveException::m_strFileName
Specifies the name of the file for this exception condition.
CString m_strFileName;
See also
CException Class
Hierarchy Chart
CArchive Class
AfxThrowArchiveException
Exception Processing