Namespaces
Variants

std::filesystem::path:: root_name

From cppreference.net
path root_name ( ) const ;
(C++17부터)

제네릭 형식 경로의 루트 이름을 반환합니다. 경로(제네릭 형식)에 루트 이름이 포함되어 있지 않은 경우 path ( ) 를 반환합니다.

목차

매개변수

(없음)

반환값

경로의 루트 이름입니다.

예외

구현에서 정의된 예외를 던질 수 있습니다.

예제

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

가능한 출력:

Current root name is: "C:"

참고 항목

경로의 루트 디렉터리를 반환합니다(존재하는 경우)
(public member function)
경로의 루트 경로를 반환합니다(존재하는 경우)
(public member function)