Share via


CFileException::m_cause

包含 CFileException 列舉類型所定義的值。

int m_cause;

備註

此資料成員是 int 類型的公用變數。 列舉程式及其意義如下:

  • CFileException::none   0:沒有發生錯誤。

  • CFileException::genericException   1:發生未指定的錯誤。

  • CFileException::fileNotFound   2:找不到檔案。

  • CFileException::badPath   3:整個或部分路徑無效。

  • CFileException::tooManyOpenFiles   4:超出允許的開啟檔案數目。

  • CFileException::accessDenied   5:無法存取檔案。

  • CFileException::invalidFile   6:嘗試使用的檔案控制代碼無效。

  • CFileException::removeCurrentDir   7:無法移除目前工作中的目錄。

  • CFileException::directoryFull   8:已沒有其他目錄項目。

  • CFileException::badSeek   9:嘗試設定檔案指標時,發生錯誤。

  • CFileException::hardIO   10:硬體發生錯誤。

  • CFileException::sharingViolation   11:未載入 SHARE.EXE,或是共用區域被鎖定。

  • CFileException::lockViolation   12:嘗試鎖定的區域已被鎖定。

  • CFileException::diskFull   14:磁碟已滿。

  • CFileException::endOfFile   15:已達到檔案結尾。

    注意事項注意事項

    這些 CFileException 原因列舉程式不同於 CArchiveException 原因列舉程式。

    注意事項注意事項

    CArchiveException::generic 已被取代。請改用 genericException。如果 generic 用在應用程式中,並且是以 /clr 建立,所產生的語法錯誤將不易破解。

範例

try
{
   CFile f(_T("M_Cause_File.dat"), CFile::modeWrite);
}
catch(CFileException* e)
{
   if( e->m_cause == CFileException::fileNotFound)
      TRACE(_T("ERROR: File not found\n"));
   e->Delete();
}

需求

標頭:afx.h

請參閱

參考

CFileException 類別

階層架構圖表