#include <windows.h>
int CreateRoot(char *buf)
{
   char *s = strrchr(buf,'\\') ;
   int rv ;
   printf("%s\n",buf) ;
   if (s && s != buf && *(s-1) != ':') {
        *s = 0 ;
        rv = CreateRoot(buf) ;
        *s = '\\' ;
        if (!rv)
                return rv ;
   }
   if (!CreateDirectory(buf,0) && GetLastError()!= ERROR_ALREADY_EXISTS)
        return 0 ;
   return 1 ;
}
main()
{
        printf("%d",CreateRoot("c:\\temp\\david\\hi\\there\\dave") ) ; 
}