Simpel måde: nej, for de enkelte mapper i stien skal oprettes separat en ad gangen - startende med toppen.
Du kan gøre noget i stil med:
FILE* createFilePath(char *filePath, char* mode) { char tmpPath[MAXPATH]; char *ptrChar; int len = 0; FILE* tmpFile = NULL;
fnsplit(filePath, /* no dir */, tmpPath, /* no file */ NULL, /* no ext. */ NULL); ptrChar = strtok(tmpPath, \"\\\\\\r\\n\"); while (ptrChar != NULL) { len += strlen(ptrChar); // Ensure that current \"sub-path\" is infact a // sub-path => next character after current string must be // a backslash. if (filePath[len] == \'\\\\\' && !chdir(ptrChar) mkdir(ptrChar); }; tmpFile = fopen(filePath, mode); return tmpFile; }
Som du selvfølgelig bør forfine med skift af drev, gem af nuv. path osv.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.