Creating a directory In C or C++

前端 未结 4 1478
悲&欢浪女
悲&欢浪女 2021-01-18 11:44

How to create a directory with C code (other than the method of forking and using mkdir) ? Is there anything like dirent.h? dirent.h only allows to read directories. (withou

4条回答
  •  春和景丽
    2021-01-18 12:05

    With the advent of c++17 we have a Filesystem library providing facilities for manipulating files and directory. To create a directory, you can use std::filesystem::create_directory.

    Example:

    #include 
    std::filesystem::create_directory("newdir");
    

提交回复
热议问题