I need an analog of c#
Directory.CreateDirectory("d:\\asd\\dsa\\123");
which will create all that directories, even if disk D is totally empty with no any directories.
I read about WinApi CreateDirectory next thing:
"ERROR_PATH_NOT_FOUND - One or more intermediate directories do not exist; this function will only create the final directory in the path."
So it's not what I looking for..
Any other ways to do what I want?
Did you try to use mkdir()
function ? Another way to use:
boost filesystem: supports standard MAX_PATH size 260.
const char dir_path[] = "c:\\temp\\cplusplus";
boost::filesystem::path dir(dir_path);
if(boost::filesystem::create_directory(dir)) {
std::cout << "Success" << "\n";
}
SHCreateDirectoryEx function for Win XP(SP2) and Higher. However, it is limited to 247 characters, which is less than the standard MAX_PATH (260) that other Win32 API filesystem functions support
32,767
wide characters, call the Unicode version of the function and prepend "\\?\"
prefix to the path. NOTE: Because most Boost.Filesystem operational functions just pass the contents of a class path object to the Windows API, they do work with the extended-length prefixes. But some won't work, because to the limitations imposed by Windows. -- Boost warning.