c++17 获取文件绝对路径 absolute path

创建日期: 2024-07-19 18:10 | 作者: 风波 | 浏览次数: 15 | 分类: C++

来源:https://en.cppreference.com/w/cpp/filesystem/absolute

#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;

int main()
{
    std::filesystem::path p = "foo.c";
    std::cout << "Current path is " << std::filesystem::current_path() << '\n';
    std::cout << "Absolute path for " << p << " is " << fs::absolute(p).string() << '\n';
}
15 浏览
9 爬虫
0 评论