Hi, I'm trying to create subfolders with loop. My partly code looks like:
char *str = "dirA/dirB/dirC/file.txt";
char *token = strtok(str, "/");
static FILINFO fno;
FRESULT fr_res;
while(token != NULL)
{
if (f_stat(token, &fno) != FR_OK)
{
fr_res = f_mkdir(token);
if (fr_res != FR_OK) {printf("Can't create dir\r\n");}
}
if (f_chdir(token) != FR_OK)
{
printf("Can't change dir\r\n");
}
token = strok(NULL, "/");
printf("Current token is %s\r\n", token);
}
So, it creates new dir but after that my app is crashing and rebooting, and it works fine if all dirs and subdirs are created (if dirA, dirB, dirC already exist) What I do wrong? Thanks in advanced