名前空間
変種
操作

std::experimental::filesystem::path::root_directory

From cppreference.com
< cpp‎ | experimental‎ | fs‎ | path
 
 
 
 
 
path root_directory() const;
(filesystem TS)

パスのルートディレクトリを返します。パスがルート名を含まない場合、path() を返します。

目次

[編集] パラメータ

(なし)

[編集] 戻り値

パスのルートディレクトリ。

[編集] 例外

実装定義の例外をスローする場合があります。

[編集]

#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
 
int main()
{
    fs::path p = fs::current_path();
 
    std::cout << "The current path " << p << " decomposes into:\n"
              << "root name " << p.root_name() << '\n'
              << "root directory " << p.root_directory() << '\n'
              << "relative path " << p.relative_path() << '\n';
}

実行結果の例

The current path "C:\Users\abcdef\Local Settings\temp" decomposes into:
root name "C:"
root directory "\"
relative path "Users\abcdef\Local Settings\temp"

[編集] 関連項目

パスのルート名を返します(存在する場合)。
(public member function) [編集]
パスのルートパスを返します(存在する場合)。
(public member function) [編集]
English 日本語 中文(简体) 中文(繁體)