std::filesystem::path:: root_path
From cppreference.net
<
cpp
|
filesystem
|
path
C++
std::filesystem::path
| Member types | ||||||||||||||||||||||||||
| Member constants | ||||||||||||||||||||||||||
| Member functions | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| Path decomposition | ||||||||||||||||||||||||||
| Non-member functions | ||||||||||||||||||||||||||
|
||||||||||||||||||||||||||
| Helper classes | ||||||||||||||||||||||||||
|
path root_path
(
)
const
;
|
(C++17以降) | |
パスのルートパスを返します。パスがルートパスを含まない場合、 path ( ) を返します。
実質的に root_name ( ) / root_directory ( ) を返します。
目次 |
パラメータ
(なし)
戻り値
パスのルートパス。
例外
実装定義の例外をスローする可能性があります。
例
このコードを実行
#include <filesystem> #include <iostream> namespace fs = std::filesystem; int main() { std::cout << "Current root path is: " << fs::current_path().root_path() << '\n'; }
出力例:
Current root path is: "C:\"
関連項目
|
パスにルート名が存在する場合、それを返す
(public member function) |
|
|
パスにルートディレクトリが存在する場合、それを返す
(public member function) |