std::filesy...::root_name(3)
πΈ NAME πΈ
okay so this page is literally std::filesystem::path::root_name - std::filesystem::path::root_name (yes, she said it twice, and she ate π
). Weβre chilling in the C++ Standard Libary manual under the std::filesy...::root_name(3) banner, and this whole page is about the std::filesystem::path::root_name member function. no cap. π
β¨ Synopsis β¨
path root_name() const; (since C++17)
This one returns the root name of the generic-format path. If the path (in generic format) does not include root name, it returns path(). thatβs the vibe check, bestie. π¦
π«Ά Parameters π«Ά
(none)β literally no parameters. zero. nada. she takes nothing and still serves. β¨
π Return value π
The root name of the path. periodt. π
π Exceptions π
May throw implementation-defined exceptions. so like, the implementation gets to pick the drama, and you just gotta deal. π
π₯ Example π₯
Run this code, bestie:
// Run this code
#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
int main()
{
std::cout << "Current root name is: " <<
fs::current_path().root_name() << '\n';
}
Possible output:
Current root name is: "C:"
π See also π
root_directoryβ returns the root directory of the path, if present (public member function). πroot_pathβ returns the root path of the path, if present (public member function). π
mwah π this cutie was served from http://cppreference.com, dated 2024.06.10, under the std::filesy...::root_name(3) banner. go off, bestie. πΈππ
π¦ 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