How do I recursively create a folder in Win32?

前端 未结 14 1287
孤城傲影
孤城傲影 2020-12-01 14:11

I\'m trying to create a function that takes the name of a directory (C:\\foo\\bar, or ..\\foo\\bar\\..\\baz, or \\\\someserver\\foo\\bar

14条回答
  •  -上瘾入骨i
    2020-12-01 14:32

    With C++17, this can be done quite easily using std::filesystem::create_directories().

    Example:

    #include 
    ...
    
    const char* path = "C:\\foo\\bar";
    std::filesystem::create_directories(path);
    

提交回复
热议问题