Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

CFileException::m_cause 

Contains values defined by a CFileException enumerated type.


int m_cause;

This data member is a public variable of type int. The enumerators and their meanings are as follows:

  • CFileException::none   No error occurred.

  • CFileException::genericException   An unspecified error occurred.

  • CFileException::fileNotFound   The file could not be located.

  • CFileException::badPath   All or part of the path is invalid.

  • CFileException::tooManyOpenFiles   The permitted number of open files was exceeded.

  • CFileException::accessDenied   The file could not be accessed.

  • CFileException::invalidFile   There was an attempt to use an invalid file handle.

  • CFileException::removeCurrentDir   The current working directory cannot be removed.

  • CFileException::directoryFull   There are no more directory entries.

  • CFileException::badSeek   There was an error trying to set the file pointer.

  • CFileException::hardIO   There was a hardware error.

  • CFileException::sharingViolation   SHARE.EXE was not loaded, or a shared region was locked.

  • CFileException::lockViolation   There was an attempt to lock a region that was already locked.

  • CFileException::diskFull   The disk is full.

  • CFileException::endOfFile   The end of file was reached.

    NoteNote

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

    NoteNote

    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.

//example for CFileException::m_cause
try
{
   CFile f( pFileName, CFile::modeCreate | CFile::modeWrite );
}

catch( CFileException* e )
{
   if( e->m_cause == CFileException::fileNotFound )
      printf( "ERROR: File not found\n")
   e->Delete();
}

Community Additions

ADD
Show:
© 2015 Microsoft