chmod 三个八进制数字 文件名
int mkdir(char *pathname, mode_t mode);
1 int main()
2 {
3 char *path="/root/tmp11";
4 if(mkdir(path, 0754)==0) /*权限设置参数,第一个0代表八进制数,754含义同上;如果创建成功,返回0*/
5 {
6 printf("created the directory %s. \n", path);
7 }
8 else
9 {
10 printf("error\n");
11 }
12 return 0;
13 }
int rmdir(char *pathname);
int creat(char *pathname, mode_t mode);/*成功时返回创建文件的句柄,否则返回-1*/
int remove(char *pathname);
int flock(int fd, int operation); /*文件锁定成功时返回0,否则返回-1*/
Linux下的文件与目录操作 BY 四喜三顺,布布扣,bubuko.com
原文:http://www.cnblogs.com/sxss/p/3621029.html