Creating a directory in C or C ++

How to create a directory with C code (except for the markup method and using mkdir)? Is there something like dirent.h? dirent.h allows you to read directories only. (without using an external library)

+4
source share
3 answers

Use the mkdir function .

#include <sys/stat.h> #include <sys/types.h> int mkdir(const char *pathname, mode_t mode); 
+6
source

If you can use C ++ (as suggested by the selected tags) and increase the libraries, the Boost file system can help you with create_directory .

If you do not want all the libraries available in your project, you can download the bcp tool to extract only the subset you need, in your case, increase the file system and its dependencies.

+5
source

Call mkdir (2) .

+2
source

Source: https://habr.com/ru/post/1301180/


All Articles