c++获取当前路径的方法是什么

在C++中,可以使用std::filesystem::current_path()函数来获取当前路径。需要包含<filesystem>头文件。

以下是一个示例代码:

#include <iostream>
#include <filesystem>

int main() {
    std::filesystem::path currentPath = std::filesystem::current_path();
    std::cout << "Current Path: " << currentPath << std::endl;
    
    return 0;
}

此代码将输出当前路径。

阅读剩余
THE END