Here is how I did it:
Lets say the user typed in as you said "c:\test\test\"
first I do a chdir("C:\"

, chdir returns non-zero if successful. Then I do a chdir to "test" then I do another chdir to test
if at any time chdir fails (except when drive letter fails) I call mkdir
Lets say c:\test did not exist here is what it would look like
// this uses pointer arithmitic, using MFC there are other
// ways
char path[128];
char current[128];
*current = 0;
char* ptr;
cin>>path;
ptr = strstr(path,"\\"

;
while(ptr)
{
strncpy(current,ptr-path);
ptr++;
if(!chdir(current))
if(strstr(current,":"

break; // invalid drive letter
else
{
mkdir(current);
chdir(current);
}
}
ptr = strstr(path,"\\"

;
}
I belive that should do it. You may need a modification if my logic is off but that is how I remember doing it.
matt