BOOL MakeSureDirectoryPathExists( const char* lpszDirPath ) //lpszDirPath 为要创建的目录,如 "c:/dir1/dir2"
{
string strDirPath = lpszDirPath;
int nPos = 0;
while( ( nPos = strDirPath.find( "//", nPos + 1 ) ) != -1 )
{
CreateDirectory( strDirPath.substr( 0, nPos ).c_str(), NULL );
}
return CreateDirectory( strDirPath.c_str(), NULL );
}
一个创建多层目录的函数
最新推荐文章于 2023-10-27 10:56:27 发布