名稱空間
變體
操作

std::filesystem::is_other

來自 cppreference.com
 
 
 
定義於標頭檔案 <filesystem>
bool is_other( std::filesystem::file_status s ) noexcept;
(1) (C++17 起)
bool is_other( const std::filesystem::path& p );
(2) (C++17 起)
bool is_other( const std::filesystem::path& p, std::error_code& ec ) noexcept;
(3) (C++17 起)

檢查給定的檔案狀態或路徑是否對應於“其他”型別的檔案。也就是說,檔案存在,但既不是常規檔案,也不是目錄,也不是符號連結。

1) 等同於 exists(s) && !is_regular_file(s) && !is_directory(s) && !is_symlink(s)
2,3) 分別等同於 is_other(status(p))is_other(status(p, ec))

目錄

[編輯] 引數

s - 要檢查的檔案狀態
p - 要檢查的路徑
ec - 儲存錯誤狀態的錯誤碼

[編輯] 返回值

如果由 p 指示的檔案或由 s 指示的型別是指一個既不是常規檔案、目錄也不是符號連結的檔案,則返回 true,否則返回 false。如果發生錯誤,非丟擲過載返回 false

[編輯] 異常

任何未標記為 noexcept 的過載都可能在記憶體分配失敗時丟擲 std::bad_alloc

2,3) 如果作業系統 API 呼叫失敗,則將 std::error_code& 引數設定為作業系統 API 錯誤程式碼,如果未發生錯誤,則執行 ec.clear()

[編輯] 示例

[編輯] 參閱

(C++17)(C++17)
確定檔案屬性
確定檔案屬性,檢查符號連結目標
(函式) [編輯]
表示檔案型別和許可權
(類) [編輯]
檢查檔案狀態是否已知
(函式) [編輯]
檢查給定路徑是否引用塊裝置
(函式) [編輯]
檢查給定路徑是否引用字元裝置
(函式) [編輯]
檢查給定路徑是否引用目錄
(函式) [編輯]
(C++17)
檢查給定路徑是否引用命名管道
(函式) [編輯]
檢查引數是否引用常規檔案
(函式) [編輯]
(C++17)
檢查引數是否引用命名 IPC 套接字
(函式) [編輯]
檢查引數是否引用符號連結
(函式) [編輯]
(C++17)
檢查路徑是否引用現有檔案系統物件
(函式) [編輯]
檢查目錄項是否引用“其他”檔案
(std::filesystem::directory_entry 的公開成員函式) [編輯]