std::experi...::root_path(3)
π std::experi...::root_path(3) π
Okay bestie, you're on the C++ Standard Libary manual page for std::experi...::root_path(3) β yes, the filesystem girlies are back, and this one is all about the root path. π
β¨
π¦ NAME π¦
std::experimental::filesystem::path::root_pathβstd::experimental::filesystem::path::root_path
It's literally the same name twice, and honestly? Iconic. π«Ά
β¨ Synopsis β¨
path root_path() const; (filesystem TS)
It's giving tiny but mighty: path root_path() const; in the (filesystem TS). πΈ
Returns the root path of the path. If the path does not include root path, returns path().
Effectively, returns the following: root_name() / root_directory(). No cap. π
π Parameters π
(none) β literally no parameters, bestie. Not a single one. π
π Return value π
The root path of the path. That's the whole assignment. π
π₯ Exceptions π₯
May throw implementation-defined exceptions. So like, keep that in mind, okay? π
π Example π
// Run this code
#include <experimental/filesystem>
#include <iostream>
namespace fs = std::experimental::filesystem;
int main()
{
std::cout << "Current root path is: " <<
fs::current_path().root_path() << '\n';
}
Possible output:
Current root path is: "C:\"
It's giving short and sweet, and the possible output is literally Current root path is: "C:\". Slay. π
π See also π
root_nameβ returns the root-name of the path, if present (public member function)root_directoryβ returns the root directory of the path, if present (public member function)
Two little besties doing related path things. Obsessed. π¦
π·οΈ Category π·οΈ
Noindexed pages
Source: http://cppreference.com Β· Version/date: 2024.06.10 Β· Page: std::experi...::root_path(3) β mwah, bye 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