c++ how to create a directory from a path

前端 未结 5 1154
迷失自我
迷失自我 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:05

    If you can use an external library, I'd look at boost::filesystem

    #include 
    namespace fs=boost::filesystem;
    
    int main(int argc, char** argv)
    {
        fs::create_directories("/some/path");
    }
    

提交回复
热议问题