日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

C语言目录操作 (Linux/Unix)

發(fā)布時(shí)間:2023/12/18 linux 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 C语言目录操作 (Linux/Unix) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

獲得工作目錄:#include?<unistd.h>?char?*getcwd(char?*buf,size_t?size);char?*getwd(char?*buf);/*this?is?for?FreeBSD*/

改變當(dāng)前目錄:#include?<unistd.h>?int?chdir(const?char?*path);

保存當(dāng)前目錄:#include?<unistd.h>?int?fchdir(int?fd);

建立新目錄:#include?<sys/type.h>?#include?<sys/stat.h>?int?mkdir(const?char?*path,mode_t?mode);

刪除目錄:#include?<unistd.h>?int?rmdir(const?char*?path);

打開目錄進(jìn)行收索:#include?<sys/type.h>#include?<dirent.h>DIR?*opendir(const?char?*pathname);?int?dirfd(DIR?*dirp);

關(guān)閉目錄:#include?<sys/types.h>#include?<dirent.h>int?closedir(DIR?*dirp);

搜索目錄:#include?<sys/type.h>#include?<dirent.h>?struct?dirent?*readdir(DIR?*dirp);

重新回到目錄的開始:#<sys/type.h>#include?<dirent.h>void?rewinddir(DIR?*dirp);

保存目錄中的位置:#include?<sys/type.h>#include?<dirent.h>long?telldir(const?DIR?*dirp);

目錄內(nèi)恢復(fù)位置:#include?<sys/type.h>#include?<dirent.h>void?seekdir(DIR?*dirp,long?loc);

掃描目錄:?#include?<sys/type.h>#include?<dirent.h>int?scandir(const?char?*diename,struct?dirent?***namelist,int?(*select)(struct?dirent?*),int?(*compar)(const?void?*,const?viod*));

遍歷目錄結(jié)構(gòu):#include?<ftw.h>int?ftw(const?char*?path,int(*fn)(const?char?*obj_path,const?struct?stat?*obj_stat,int?obj_flags),int?depth);

int?nftw(const?char*?path,int(*fn)(const?char?*obj_path,const?struct?stat?*obj_stat,int?obj_flags,struct?FTW?obj_FTW),int?depth,int?flags);

改變根目錄:#include?<unistd.h>int?chroot(const?char?*dirname);

總結(jié)

以上是生活随笔為你收集整理的C语言目录操作 (Linux/Unix)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。