复制代码 代码如下:
#includeint _mkdir( const char *dirname );
参数:
dirname是目录的路径名指针
返回值:
如果新目录的创建时间,这些功能中的每一个返回值 0。 在错误,则函数返回 – 1
复制代码 代码如下:
#include int mkdir(const char *path, mode_t mode);
参数:
path是目录名
mode是目录权限
返回值:
返回0 表示成功, 返回 -1表示错误,并且会设置errno值。
mode模式位:
mode 表示新目录的权限,可以取以下值:
s_irusr
s_iread
s_iwusr
s_iwrite
s_ixusr
s_iexec
s_irwxu
this is equivalent to (s_irusr | s_iwusr | s_ixusr).
s_irgrp
read permission bit for the group owner of the file. usually 040.
s_iwgrp
write permission bit for the group owner of the file. usually 020.
s_ixgrp
execute or search permission bit for the group owner of the file. usually 010.
s_irwxg
this is equivalent to (s_irgrp | s_iwgrp | s_ixgrp).
s_iroth
read permission bit for other users. usually 04.
s_iwoth
write permission bit for other users. usually 02.
s_ixoth
execute or search permission bit for other users. usually 01.
s_irwxo
this is equivalent to (s_iroth | s_iwoth | s_ixoth).
s_isuid
this is the set-user-id on execute bit, usually 04000. see how change persona.
s_isgid
this is the set-group-id on execute bit, usually 02000. see how change persona.
s_isvtx
this is the sticky bit, usually 01000.
阿里云-虚拟数字人
阿里云-虚拟数字人是什么? …
2 查看详情
s_irwxu 00700权限,代表该文件所有者拥有读,写和执行操作的权限
s_irusr(s_iread) 00400权限,代表该文件所有者拥有可读的权限
s_iwusr(s_iwrite) 00200权限,代表该文件所有者拥有可写的权限
s_ixusr(s_iexec) 00100权限,代表该文件所有者拥有执行的权限
s_irwxg 00070权限,代表该文件用户组拥有读,写和执行操作的权限
s_irgrp 00040权限,代表该文件用户组拥有可读的权限
s_iwgrp 00020权限,代表该文件用户组拥有可写的权限
s_ixgrp 00010权限,代表该文件用户组拥有执行的权限
s_irwxo 00007权限,代表其他用户拥有读,写和执行操作的权限
s_iroth 00004权限,代表其他用户拥有可读的权限
s_iwoth 00002权限,代表其他用户拥有可写的权限
s_ixoth 00001权限,代表其他用户拥有执行的权限
下面再给大家详细介绍下linux中mkdir函数详解
mkdir函数
头文件库:
#include
#include
函数原型:
int mkdir(const char *pathname, mode_t mode);
函数说明:
mkdir()函数以mode方式创建一个以参数pathname命名的目录,mode定义新创建目录的权限。
返回值:
若目录创建成功,则返回0;否则返回-1,并将错误记录到全局变量errno中。
mode方式:
s_irwxu 00700权限,代表该文件所有者拥有读,写和执行操作的权限
s_irusr(s_iread) 00400权限,代表该文件所有者拥有可读的权限
s_iwusr(s_iwrite) 00200权限,代表该文件所有者拥有可写的权限
s_ixusr(s_iexec) 00100权限,代表该文件所有者拥有执行的权限
s_irwxg 00070权限,代表该文件用户组拥有读,写和执行操作的权限
s_irgrp 00040权限,代表该文件用户组拥有可读的权限
s_iwgrp 00020权限,代表该文件用户组拥有可写的权限
s_ixgrp 00010权限,代表该文件用户组拥有执行的权限
s_irwxo 00007权限,代表其他用户拥有读,写和执行操作的权限
s_iroth 00004权限,代表其他用户拥有可读的权限
s_iwoth 00002权限,代表其他用户拥有可写的权限
s_ixoth 00001权限,代表其他用户拥有执行的权限
以上就是mkdir函数在Linux中与Windows中的区别是什么的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/243346.html
微信扫一扫
支付宝扫一扫