You can't use strtok() on string constants according to the man page:
Code:
BUGS
Never use these functions. If you do, note that:
These functions modify their first argument.
These functions cannot be used on constant strings.
So if main() looks like:
Code:
int main(void)
{
mkdirp("newdir");
return 0;
}
...it will crash. But this should work:
Code:
int main(void)
{
char dirname[] = "newdir";
mkdirp(dirname);
return 0;
}