小编Dev*_*-il的帖子

从 std::filesystem::path c++ 获取绝对路径

我有这段代码

auto path = std::filesystem::path("/root/home/../opt/.");
Run Code Online (Sandbox Code Playgroud)

我曾尝试过, std::filesystem::absolute()但后来意识到这是因为我想要的结果之外的其他东西

我的问题是如何将该相对路径转换为绝对路径,以便结果是"/root/opt/".

我在 Debian g++-9 上使用 c++17

c++ filepath c++-standard-library c++17 std-filesystem

6
推荐指数
2
解决办法
2234
查看次数