Home php教程 PHP开发 The difference between the mkdir function in Linux and the _mkdir function in Windows

The difference between the mkdir function in Linux and the _mkdir function in Windows

Dec 21, 2016 pm 03:31 PM
mkdir

Let’s first introduce to you the _mkdir function under Windows

#include<direct.h>
int _mkdir( const char *dirname );
Copy after login

Parameters:

dirname is the pathname pointer of the directory

Return value:

If the creation time of the new directory, each of these functions returns a value of 0. In error, the function returns – 1

Detailed explanation of mode_t parameters of mkdir function under Linux

#include <sys/stat.h>
int mkdir(const char *path, mode_t mode);
Copy after login

Parameters:

path is the directory name

mode is the directory permissions

Return value:

Return 0 for success, return -1 Indicates an error and the errno value will be set.

mode mode bit:

mode represents the permissions of the new directory and can take the following values:

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. 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. the set-group-ID on execute bit, usually 02000. See How Change Persona.
S_ISVTX
This is the sticky bit, usually 01000.

S_IRWXU 00700 permission, which means the file owner has read, write and execute permissions
S_IRUSR(S_IREAD) 00400 permissions, which means the file owner has readable permissions
S_IWUSR(S_IWRITE) 00200 permissions, which means the file owner has writable permissions

S_IXUSR(S_IEXEC) 00100 permissions, which means the file owner has writable permissions Execution permissions

S_IRWXG 00070 permissions, which means that the file user group has the permissions to read, write and execute operations
S_IRGRP 00040 permissions, which means that the file user group has readable permissions
S_IWGRP 00020 permissions, which means that the file user group has the writable permissions
S_IXGRP 00010 permission, which means that the file user group has execution permissions
S_IRWXO 00007 permissions, which means other users have the permissions to read, write and execute operations
S_IROTH 00004 permissions, which means other users have readable permissions
S_IWOTH 00002 permissions , which means other users have writable permissions
S_IXOTH 00001 permission, which means other users have execution permissions

The following will give you a detailed introduction to the mkdir function in Linux

mkdir function

Header file library:

#include < ;sys/stat.h>

#include

Function prototype:


int mkdir(const char *pathname, mode_t mode);

Function description:


mkdir() function starts with Mode mode creates a directory named with the parameter pathname, and mode defines the permissions of the newly created directory.

Return value:


If the directory is successfully created, 0 is returned; otherwise -1 is returned, and the error is recorded in the global variable errno.

mode mode:


S_IRWXU 00700 permission, which means that the file owner has the permission to read, write and execute operations

S_IRUSR(S_IREAD) 00400 permission, which means that the file owner has readability

S_IWUSR(S_IWRITE) 00200 Permissions, which means that the file owner has writable permissions

S_IXUSR(S_IEXEC) 00100 permissions, which means that the file owner has execution permissions

S_IRWXG 00070 permissions, which means that the file user group has read, write and execute permissions
S_IRGRP 00040 permissions, which means that the file user group has readable permissions
S_IWGRP 00020 permissions, which means that the file user group has writeable permissions
S_IXGRP 00010 permissions, which means that the file user group has execution permissions
S_IRWXO 00007 permissions, which represents other users Have permissions to read, write and execute operations
S_IROTH 00004 permissions, representing other users with readable permissions
S_IWOTH 00002 permissions, representing other users with writable permissions
S_IXOTH 00001 permissions, representing other users with execution permissions




For more related articles on the difference between the mkdir function in Linux and the _mkdir function in Windows, please pay attention to the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)