10-03-2009
1,
0
Join Date: Oct 2009
Last Activity: 20 October 2009, 4:17 AM EDT
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
how to simulate "mkdir -p /home/blah1/blah2/blah3" in "c" where only /home exist
I'm trying to make use of mkdir(char *pathname, S_IRWXU) to create the directories.
but it only creates one directory at a time. so I have to separate the tokens for "/home/blah1/blah2/blah3" as "home blah1 blah2 blah3" using delimiter "/", but it is again hectic to create such directory structure.
I know Linux command "mkdir -p /home/blah1/blah2/blah3" would create all the sub-directories if it doesn't exist.
how to achieve the same "mkdir -p /home/blah1/blah2/blah3" in "c" where only /home exist
I'm using Redhat Linux 9 on Intel board 915GLVG