#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h>
int main(int argc,char *argv[])
{
char path[1000];
char file[1000];
if(argc!=2)
{
printf("Usage:mk<pathname>\n");
return 1;
}
getpwd(path);
printf("current directory is :%s\n",path);
if(mkdir(argv[1],S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH)<0)
{
printf("mkdir failed \n");
return 2;
}
if(chdir(argv[1])<0)
{
printf("chdir failed \n");
return 3;
}
getpwd(path);
printf("mkdir successful \n New current directory is :%s\n",path);
/*
rmdir(path);
*/
return 0;
}
c file file s
猜你喜欢
转载自brucefight.iteye.com/blog/1044489
今日推荐
周排行