Creating Mulitple Levels of Directories
Posted
by Josh Carlson
on February 16th, 2001
void CreateAllDirectories(CString strDir)
{
// remove ending / if exists
if(strDir.Right(1)=="\\")
strDir=strDir.Left(strDir.GetLength()-1);
// base case . . .if directory exists
if(GetFileAttributes(strDir)!=-1)
return;
// recursive call, one less directory
int nFound = strDir.ReverseFind('\\');
CreateAllDirectories(strDir.Left(nFound));
// actual work
CreateDirectory(strDir,NULL);
}

Comments
I used MakeSureDirectoryPathExists successfully
Posted by Legacy on 11/16/2001 12:00amOriginally posted by: Adrian Vinca
So, I used MakeSureDirectoryPathExists from Imagehlp.h (instead of Dbghelp.h - I don't know where may I find this file). Do not forget to add to your project also Imagehlp.lib.
ReplyA much more optimized method
Posted by Legacy on 08/13/2001 12:00amOriginally posted by: Anonymous
Replywhy not to use the api...
Posted by Legacy on 07/25/2001 12:00amOriginally posted by: Kevin
I looked and my default installation of VC and whatever SDKs I have installed do not have the Dbghelp.h file. So I am assuming that I would have to go thru the trouble of installing something else to get this. I am also assuming this means another DLL would have to go with my executable...
Reply