关于Linux目录访问函数总结
Linux下目录访问函数总结,主要是涉及到的函数,以及所在头文件。
获得工作目录:
#include <unistd.h>
char *getcwd(char *buf,size_t size);char *getwd(char *buf);/*this is for FreeBSD*/
改变当前目录:
#include <unistd.h>
int chdir(const char *path);
保存当前目录:
#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);
打开目录进行搜索:
#include <sys/type.h>
#include <dirent.h>
DIR *opendir(const char *pathname); int dirfd(DIR *dirp);
关闭目录:
#include <sys/types.h>
#include <dirent.h> int closedir(DIR *dirp);
搜索目录:
#include <sys/type.h>
#include <dirent.h>
struct dirent *readdir(DIR *dirp);
重新回到目录的开始:
#include <sys/type.h>
#include <dirent.h>
void rewinddir(DIR *dirp);
保存目录中的位置:
#include <sys/type.h>
#include <dirent.h>
long telldir(const DIR *dirp);
在目录内恢复位置:
#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*));
遍历目录结构:
#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);
关于Linux目录访问函数总结的更多相关文章
- linux查看访问windows共享目录NT_STATUS_DUPLICATE_NAME问题解决
linux查看访问windows共享目录NT_STATUS_DUPLICATE_NAME问题解决 [jason@superfreak ~]$ smbclient //powerhouse-smb.my ...
- 在Linux下访问Windows共享目录的配置方法
在Linux下访问Windows共享目录的配置方法 1.在Windows上设置一个共享目录 如:将d:\RedHat_disk设置为共享目录 2.在Windows上创建一个用户,如tommy,密码11 ...
- 【Linux C中文函数手册】之 目录操作函数
目录操作函数 1)closedir 关闭目录 相关函数: opendir表头文件: #include<sys/types.h> #include<dirent.h>定义函数: ...
- linux系统编程之文件与IO(四):目录访问相关系统调用
1. 目录操作相关的系统调用 1.1 mkdir和rmdir系统调用 1.1.1 实例 1.2 chdir, getcwd系统调用 1.2.1 实例 1.3 o ...
- CentOS Linux SVN服务器 配置用户目录访问 权限 Authorization failed
SVN 修改 aurhz 文件设置用户目录访问权限格式: [/code] user=rw user 用户对code目录拥有读和写的权限. 但是访问 svn://192.168.1.59 的时候却提示A ...
- 详解Linux目录(目录树详细解释)
给大家一篇关于Linux目录 方面的详细说明,好好读一下! Linux目录详解(RHEL5.4) linux有四种基本文件系统类型:--普通文件:如文本文件.c语言源代码.shell脚本等,可以用ca ...
- Linux 目录配置
一.Linux 目录配置标准:FHS FHS(Filessystem Hierarchy Standard) 的重点在于规范每个特定的目录下应该要放置什么样子的数据. FHS依据文件系统使用的频繁与否 ...
- day 2 Linux目录结构
Linux系统的目录结构的基本介绍: 1)在逻辑上的所有目录(包括目录下的子目录)都在最高级别的目录“/”下. 根(/)目录是Linux系统中所有目录的起始点(顶点),根下面的目录及子目录是一个有层次 ...
- 【Linux】Linux 目录结构
博客已转移,请借一步说话 .http://www.weixuehao.com/archives/492 初学Linux,首先需要弄清Linux 标准目录结构 / root --- 启动Linux时使用 ...
随机推荐
- Unity-JobSystem
NativeContainer 为什么 为解决Job之间数据处理结果的隔离问题. 是什么 NativeContainer是托管的值类型,可以相对安全的操作native内存. 注意 不能两个job同时写 ...
- 使用Java带你打造一款简单的英语学习系统
[一.项目背景] 随着移动互联网的发展,英语学习系统能结构化的组织海量资料.针对用户个性需求,有的放矢地呈现给用户,从而为英语学习者提供便利,提升他们的学习效率. [二.项目目标] 1. 实现美观的界 ...
- 三、Python系列——Pandas数据库读取数据
Pandas主要先读取表格类型的数据,然后进行分析. import pandas as pd# 由于是用pandas模块操作数据,因此不用在路径前加open,否则就是python直接打开文件,可能还会 ...
- node -v node is not define
安装node js 踩过的坑 应该是在CMD 命令里执行 node -v 我却傻傻的跑到 node.js 里执行 node -v 结果就报 node is not define 真相如下图!!!
- Burp Suite Proxy Module - 代理模块
官方参考链接:https://portswigger.net/burp/documentation/desktop/tools/proxy/using 1.Burp Suite 代理设置选项 2.浏览 ...
- Vuex里的module选项和移动端布局
Vuex里的modules 在store文件夹里创建一个modules的文件夹,里面随意创建一个.js文件,然后export输出
- Python基础知识点:多进程的应用讲解
前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:东哥IT笔记 现在很多CPU都支持多核,甚至是手机都已经开始支持多核 ...
- vue如何使用excel导出后台数据
let params = { // 请求参数 要下载Excel的id 'id':this.excelId }; //导入的接口名 api_excel_exportExcel().then(res =& ...
- 好用的npm模块记录
标签: node node盛行的今天,前端开发已经离不开npm模块的使用,大名鼎鼎的如gulp,webpack等,此处不多说,除了它们有那么几个常用的npm模块是我喜欢并依赖它的,下面就是我平时工作中 ...
- django 学习记录(一)
不使用 drf 来实现django 的 api 接口 json序列化 from django.shortcuts import render from django.views.generic.bas ...