1.创建目录操作
int mkdir(char *path,mode_t mode); //成功返回0,否则返回-1
头文件 sys/types.h sys/stat.h
#include <stdio.h>
#include <sys/types.h>
#inlcude <sys/stat.h>
#include <errno.h>
int main()
{
extern int errno;
char *path="/root/temp"
if(mkdir(path,0766)==0)
{
printf("create the dirstroy %s. \n",path);
}
else
{
printf ("can't create the direstroy %s.\n",path);
printf("Error: %d\n",errno);
printf("ERR : %s\n",strerror(errno));
}
}