---
title: "c file file s "
author: "brucefight"
date: "2011-05-15T03:01:20Z"
tags: []
categories: ["企业架构"]
slug: "c-file-file-s"
draft: false
lastmod: "2011-05-15T03:01:20Z"
id: 1044489
url: "https://brucefight.iteye.com/blog/1044489"
---

#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
#include <sys/stat.h>

int main(int argc,char *argv)
{
    char path;
    char file;
    if(argc!=2)
    {
	printf("Usage:mk<pathname>\n");
	return 1;
    }
    getpwd(path);
    printf("current directory is :%s\n",path);
    if(mkdir(argv,S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH)<0)
    {
	printf("mkdir failed \n");
        return 2;
    }
    if(chdir(argv)<0)
    {
        printf("chdir failed \n");
        return 3;
    }
    getpwd(path);
    printf("mkdir successful \n New current directory is :%s\n",path);
    /*
    rmdir(path);
    */
    return 0;
}