std::experimental::filesystem::path:: relative_path
From cppreference.net
<
cpp
|
experimental
|
fs
|
path
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Filesystem library
| Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
path
| Member functions | ||||
| Path decomposition | ||||
| Non-member functions | ||||
|
path relative_path
(
)
const
;
|
(파일시스템 TS) | |
root path 에 대한 상대 경로를 반환합니다. * this 가 빈 경로인 경우, 빈 경로를 반환합니다.
목차 |
매개변수
(없음)
반환값
루트 경로 에 대한 상대 경로입니다.
예외
구현 정의 예외를 던질 수 있습니다.
예제
이 코드 실행
#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) |