名前空間
変種
操作

std::filesystem::path::root_name

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

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

目次

[編集] 引数

(なし)

[編集] 戻り値

パスのルート名。

[編集] 例外

(なし)

[編集]

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
 
int main()
{
    std::cout << "Current root name is: " << fs::current_path().root_name() << '\n';
}

出力例:

Current root name is: "C:"

[編集] 関連項目

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