std::experimental::filesystem::path::relative_path
From cppreference.com
< cpp | experimental | fs | path
| path relative_path() const; |
(filesystem TS) | |
ルートパスに対する相対パスを返します。パスが空の場合、空のパスを返します。
目次 |
[編集] パラメータ
(なし)
[編集] 戻り値
ルートパスに対する相対パス。
[編集] 例外
実装定義の例外をスローする場合があります。
[編集] 例
このコードを実行
#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-path " << p.root_path() << '\n' << "relative path " << p.relative_path() << '\n'; }
実行結果の例
The current path "C:\Users\abcdef\Local Settings\temp" decomposes into: root-path "C:\" relative path "Users\abcdef\Local Settings\temp"
[編集] 関連項目
| パスのルート名を返します(存在する場合)。 (public member function) | |
| パスのルートディレクトリを返します(存在する場合)。 (public member function) | |
| パスのルートパスを返します(存在する場合)。 (public member function) |