void CreateDirectory()
{
char* pchEnv = "XXX" ;
char chPathName[MAX_PATH];
if ( 0 == ::GetEnvironmentVariable( pchEnv, chPathName, MAX_PATH ))
{
return;
}
WIN32_FIND_DATA findData;
HANDLE hFind = ::FindFirstFile( chPathName, &findData );
if (( INVALID_HANDLE_VALUE != hFind ) && ( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ))
{
//
}
else
{
if ( !::CreateDirectory( chPathName, NULL ))
{
::FindClose( hFind );
return;
}
}
::FindClose( hFind );
retuen;
}
/
void CreateMultiFIle()
{
char* pchEnv = "XXX" ;
char chPathName[MAX_PATH] = { '/0' };
if ( 0 == ::GetEnvironmentVariable( pchEnv, chPathName, MAX_PATH ))
{
return;
}
CString csFilePath = chPathName;
if ( '//' != csFilePath[csFilePath.GetLength() - 1] )
{
csFilePath.Insert( csFilePath.GetLength(), '//' );
}
std::vector<CString> vtPath;
int nPos = 0;
while (( nPos = csFilePath.ReverseFind( '//' )) > 1 )
{
csFilePath = csFilePath.Left( nPos );
vtPath.push_back( csFilePath );
}
for ( int n = vtPath.size() - 2; n >= 0; n-- )
{
WIN32_FIND_DATA findData;
HANDLE hFind = ::FindFirstFile( vtPath[n], &findData );
if (( INVALID_HANDLE_VALUE != hFind ) &&
( findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ))
{
//
}
else
{
if ( !::CreateDirectory( vtPath[n], NULL ))
{
::FindClose( hFind );
return;
}
}
::FindClose( hFind );
// ::CreateDirectory( vtPath[n], NULL );
}
}