title | ms.custom | ms.date | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | f1_keywords | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CArchiveException Class | Microsoft Docs |
11/04/2016 |
|
reference |
|
|
|
da31a127-e86c-41d1-b0b6-bed0865b1b49 |
21 |
mikeblome |
mblome |
ghogen |
Represents a serialization exception condition
class CArchiveException : public CException
Name | Description |
---|---|
CArchiveException::CArchiveException | Constructs a CArchiveException object. |
Name | Description |
---|---|
CArchiveException::m_cause | Indicates the exception cause. |
CArchiveException::m_strFileName | Specifies the name of the file for this exception condition. |
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).
CArchiveException
Header: afx.h
Constructs a CArchiveException
object, storing the value of cause
in the object.
CArchiveException(
int cause = CArchiveException::none,
LPCTSTR lpszArchiveName = NULL);
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.
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
.
Specifies the cause of the exception.
int m_cause;
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::none No error occurred.
-
CArchiveException::genericException 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 theCFileException
cause enumerators.[!NOTE] CArchiveException::generic is deprecated. Use genericException instead. If generic is used in an application and built with /clr, there will be syntax errors that are not easy to decipher.
Specifies the name of the file for this exception condition.
CString m_strFileName;
CException Class
Hierarchy Chart
CArchive Class
AfxThrowArchiveException
Exception Processing