当前位置: 技术问答>linux和unix
在linux中利用C++实现新建目录的功能
来源: 互联网 发布时间:2016-09-05
本文导语: 如题: 请问如何实现: 能不使用shell命令去调用linux的新建目录命令来进行实现吗? | $ man 2 mkdir NAME mkdir - create a directory SYNOPSIS #include #include int mkdir(const char *pathname, mode_t mo...
如题:
请问如何实现:
能不使用shell命令去调用linux的新建目录命令来进行实现吗?
请问如何实现:
能不使用shell命令去调用linux的新建目录命令来进行实现吗?
|
$ man 2 mkdir
NAME
mkdir - create a directory
SYNOPSIS
#include
#include
int mkdir(const char *pathname, mode_t mode);
DESCRIPTION
mkdir attempts to create a directory named pathname.
The parameter mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode & ~umask & 0777). Other mode bits of the created directory depend on the operating system. For Linux, see below.
The newly created directory will be owned by the effective uid of the process. If the directory containing the file has the set group id bit set, or if the filesystem is mounted with BSD group semantics, the new directory will inherit the group ownership from its parent; otherwise it will be owned by the effective gid of the process.
If the parent directory has the set group id bit set then so will the newly created directory.
......
NAME
mkdir - create a directory
SYNOPSIS
#include
#include
int mkdir(const char *pathname, mode_t mode);
DESCRIPTION
mkdir attempts to create a directory named pathname.
The parameter mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode & ~umask & 0777). Other mode bits of the created directory depend on the operating system. For Linux, see below.
The newly created directory will be owned by the effective uid of the process. If the directory containing the file has the set group id bit set, or if the filesystem is mounted with BSD group semantics, the new directory will inherit the group ownership from its parent; otherwise it will be owned by the effective gid of the process.
If the parent directory has the set group id bit set then so will the newly created directory.
......
|
system("mkdir /tmp/test");
|
能!
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。