c++ how to create a directory from a path

前端 未结 5 1155
迷失自我
迷失自我 2020-12-20 15:06

what is a convenient way to create a directory when a path like this is given: \"\\server\\foo\\bar\\\"

note that the intermediate directories may not exist.

5条回答
  •  借酒劲吻你
    2020-12-20 16:03

    Since C++17:

    bool create_directories( const std::filesystem::path& p );
    bool create_directories( const std::filesystem::path& p, std::error_code& ec );
    

    More info: https://en.cppreference.com/w/cpp/filesystem/create_directory

提交回复
热议问题