首页 > 运维 > linux运维 > 正文

mkdir函数在Linux中与Windows中的区别是什么

WBOY
发布: 2023-05-20 22:49:04
转载
914人浏览过

复制代码 代码如下:

#include<direct.h>
int _mkdir( const char *dirname );
登录后复制

参数:

dirname是目录的路径名指针

返回值:

如果新目录的创建时间,这些功能中的每一个返回值 0。 在错误,则函数返回 – 1

linux下mkdir函数mode_t参数详解

复制代码 代码如下:

#include <sys/stat.h>
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 <sys/stat.h>
#include <sys/types.h>

函数原型:

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中的区别是什么的详细内容,更多请关注php中文网其它相关文章!

相关标签:
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:亿速云网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号