Share via


CFileException Class

Represents a file-related exception condition.

class CFileException : public CException

Members

Public Constructors

Name

Description

CFileException::CFileException

Constructs a CFileException object.

Public Methods

Name

Description

CFileException::ErrnoToException

Returns cause code corresponding to a run-time error number.

CFileException::GetErrorMessage

Retrieves the message describing an exception.

CFileException::OsErrorToException

Returns a cause code corresponding to an operating system error code.

CFileException::ThrowErrno

Throws a file exception based on a runtime error number.

CFileException::ThrowOsError

Throws a file exception based on an operating system error number.

Public Data Members

Name

Description

CFileException::m_cause

Contains portable code corresponding to the exception cause.

CFileException::m_lOsError

Contains the related operating-system error number.

CFileException::m_strFileName

Contains the name of the file for this exception.

Remarks

The CFileException class includes public data members that hold the portable cause code and the operating-system-specific error number. The class also provides static member functions for throwing file exceptions and for returning cause codes for both operating-system errors and C run-time errors.

CFileException objects are constructed and thrown in CFile member functions and in member functions of derived classes. You can access these objects within the scope of a CATCH expression. For portability, use only the cause code to get the reason for an exception. For more information about exceptions, see the article Exception Handling (MFC).

Inheritance Hierarchy

CObject

CException

CFileException

Requirements

Header: afx.h

See Also

Reference

CException Class

Hierarchy Chart

Other Resources

Exception Processing