January 14, 2011
C/C++ Create Directory
We can type “mkdir dirname” command at konsole to create dirname directory. If we can create a directory from C/C++ we can use command mkdir(path, mode) to create directory. Example :
#include <sys/stat.h> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> main() { if(mkdir("pathname",0777)==-1)//creating a directory { printf("error create directory\n"); exit(1); } else printf("success create directory\n"); }
Save code with name main.c and compile code with command :
gcc main.c -o createdir
type ./createdir at konsole to running program. When you running this program, program createdir will create pathname folder.
Source : http://pubs.opengroup.org/onlinepubs/009695399/functions/mkdir.html http://www.go4expert.com/forums/showthread.php?t=9031One Comment
I agree with the post above and I will grab more information from google [url=http://www.google.pi]google[/url]