std::experimental::filesystem::path::root_path
來自 cppreference.com
< cpp | experimental | fs | path
path root_path() const; |
(檔案系統 TS) | |
返回路徑的根路徑。如果路徑不包含根路徑,則返回 path()。
實際上,返回以下內容: root_name() / root_directory()
目錄 |
[編輯] 引數
(無)
[編輯] 返回值
路徑的根路徑。
[編輯] 異常
可能丟擲實現定義的異常。
[編輯] 示例
執行此程式碼
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { std::cout << "Current root path is: " << fs::current_path().root_path() << '\n'; }
可能的輸出
Current root path is: "C:\"
[編輯] 參閱
返回路徑的根名(如果存在) (公共成員函式) | |
返回路徑的根目錄(如果存在) (公共成員函式) |