Path components

    0

    0

    Giovanny Gongora

    Codiga's C++ Recipes

    List parts of a path

    #include <fstream>
    
    fs::path p{"C:\\Windows\\System\\photo.jpg"};
    cout << "p.root_name(): " << p.root_name() << '\n';
    cout << "p.root_directory(): " << p.root_directory() << '\n';
    cout << "p.root_path(): " << p.root_path() << '\n';
    cout << "p.relative_path(): " << p.relative_path() << '\n';
    cout << "p.parent_path(): " << p.parent_path() << '\n';
    cout << "p.filename(): " << p.filename() << '\n';
    cout << "p.stem(): " << p.stem() << '\n';
    cout << "p.extension(): " << p.extension() << '\n';
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Explore
    • Cookbooks
    • Playground
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.