名前空間
変種
操作

std::filesystem::path::root_path

提供: cppreference.com
< cpp‎ | filesystem‎ | path
 
 
 
 
path root_path() const;
(C++17以上)

パスのルートパスを返します。 パスにルートパスが含まれていなければ path() を返します。

実質的に root_name() / root_directory() を返します。

目次

[編集] 引数

(なし)

[編集] 戻り値

パスのルートパス。

[編集] 例外

(なし)

[編集]

#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:\"

[編集] 関連項目

もしあれば、パスのルート名を返します
(パブリックメンバ関数) [edit]
もしあれば、パスのルートディレクトリを返します
(パブリックメンバ関数) [edit]