std::experi...ot_directory(3)
π std::experimental::filesystem::path::root_directory π
okay so bestie, this page is from the C++ Standard Libary manual β the page id is std::experi...ot_directory(3) β and itβs all about the member function std::experimental::filesystem::path::root_directory. no cap, itβs a tiny one, but every detail is staying. π
π NAME π
std::experimental::filesystem::path::root_directory β literally the same name, twice, because thatβs how this page rolls. π«Ά
β¨ Synopsis β¨
Hereβs the signature, copied exactly because we do not mess with code:
path root_directory() const; (filesystem TS)
It returns the root directory of the path. If the path does not include root name, returns path(). (Thatβs the original wording, bestie β keep it close.) πΈ
π Parameters π
- (none) β yep, zero parameters. the void is the vibe. π
π¦ Return value π¦
The root directory of the path. thatβs it. thatβs the return value. β¨
π₯ Exceptions π₯
May throw implementation-defined exceptions. so like, it may throw, and the details are implementation-defined β no invented drama from me. π
π Example π
The original says βRun this code,β so hereβs the code, exactly:
// Run this code
#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';
}
Possible output:
The current path "C:\Users\abcdef\Local Settings\temp" decomposes into:
root name "C:"
root directory "\"
relative path "Users\abcdef\Local Settings\temp"
π See also π
root_nameβ returns the root-name of the path, if present. itβs a public member function. πroot_pathβ returns the root path of the path, if present. also a public member function. β
π·οΈ Category π·οΈ
- Noindexed pages β thatβs the category listed on the page. periodt.
π«Ά okay thatβs the whole page, bestie β source/version/date: cppreference.com Β· 2024.06.10 Β· manual: std::experi...ot_directory(3) (C++ Standard Libary) π
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms