首頁  >  文章  >  運維  >  mkdir函數在Linux中與Windows中的差異是什麼

mkdir函數在Linux中與Windows中的差異是什麼

WBOY
WBOY轉載
2023-05-20 22:49:04808瀏覽

複製程式碼 程式碼如下:

#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是目錄權限

回傳值:

傳回表示成功,傳回-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. usally 04_iwp. ##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 iswxg#this is (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.
write #cute bit for other users. usually#.或 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 exeute-user-id 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 stally 10,00011 月 0.

s_irwxu 00700權限,代表該檔案擁有者擁有讀取,寫入和執行操作的權限
s_irusr(s_iread) 00400權限,代表該檔案擁有者擁有可讀的權限
s_iwusr(s_iwrite ) 00200權限,代表該檔案擁有者擁有可寫入的權限

s_ixusr(s_iexec) 00100權限,代表該檔案擁有者擁有執行的權限

s_irwxg 00070權限,代表該檔案使用者群組擁有讀取,寫入和
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 4dff7ee23e2c96b7edeece6271d7ec5e#include da996ff59ef1c1fa2f19eea6833e0f6c


函數原型:

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_iroth 00004權限,代表其他使用者使用者擁有可讀取的權限
s_iwoth 00002權限,代表其他使用者擁有可寫入的權限
s_ixoth 00001權限,代表其他使用者擁有執行的權限

以上是mkdir函數在Linux中與Windows中的差異是什麼的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:yisu.com。如有侵權,請聯絡admin@php.cn刪除