#include<iostream>
#include<windows.h>
#include<string>
#include<atlstr.h>
using std::string;
void CreateMultiDir(const string& strPath)
{
string strTmpPath(strPath);
if (strTmpPath.find_last_of("\\") != strTmpPath.length() - 1)
{
strTmpPath += "\\";
}
int nPrePos = 0;
int nCurrPos = 0;
while (nCurrPos = strTmpPath.find_first_of("\\", nCurrPos), nCurrPos != -1)
{
while (nCurrPos != nPrePos)
{
CreateDirectory((CA2W)strTmpPath.substr(0, ++nCurrPos).c_str(), NULL);
nPrePos = nCurrPos;
}
}
}
#include<windows.h>
#include<string>
#include<atlstr.h>
using std::string;
void CreateMultiDir(const string& strPath)
{
string strTmpPath(strPath);
if (strTmpPath.find_last_of("\\") != strTmpPath.length() - 1)
{
strTmpPath += "\\";
}
int nPrePos = 0;
int nCurrPos = 0;
while (nCurrPos = strTmpPath.find_first_of("\\", nCurrPos), nCurrPos != -1)
{
while (nCurrPos != nPrePos)
{
CreateDirectory((CA2W)strTmpPath.substr(0, ++nCurrPos).c_str(), NULL);
nPrePos = nCurrPos;
}
}
}