std::filesystem::path::root_path
提供: cppreference.com
<tbody>
</tbody>
path root_path() const; |
(C++17以上) | |
パスのルートパスを返します。 パスにルートパスが含まれていなければ path() を返します。
実質的に
root_name() / root_directory()
を返します。
引数
(なし)
戻り値
パスのルートパス。
例外
(なし)
例
Run this code
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
std::cout << "Current root path is: " << fs::current_path().root_path() << '\n';
}
出力例:
Current root path is: "C:\"
関連項目
| もしあれば、パスのルート名を返します (パブリックメンバ関数) | |
| もしあれば、パスのルートディレクトリを返します (パブリックメンバ関数) |