realpath和access函数浅谈
来源:互联网 发布:河南民生频道网络直播 编辑:程序博客网 时间:2024/06/05 15:41
在我所做项目中,用上了realpath和access函数,整理一下
一.主要说明
1.realpath函数
头文件: #include <limits.h> #include <stdlib.h> 函数原型:char *realpath(const char *path, char *resolved_path) 函数说明:realpath()用来将参数path所指的相对路径转换成绝对路径后存于参数resolved_path所指的字符串数组或指针中 返回值: 成功则返回指向resolved_path的指针,失败返回NULL,错误代码存于errno
2.access函数
NAME access - determine accessibility of a fileSYNOPSIS #include <unistd.h> int access(const char *path, int amode);
DESCRIPTION The access() function shall check the file named by the pathname pointed to by the path argument for accessibility according to the bit pattern contained in amode, using the real user ID in place of the effective user ID and the real group ID in place of the effective group ID. The value of amode is either the bitwise-inclusive OR of the access permissions to be checked (R_OK, W_OK, X_OK) or the exis‐tence test (F_OK). If any access permissions are checked, each shall be checked individually, as described in the Base Definitions volume of IEEE Std 1003.1-2001, Chapter 3, Definitions. If the process has appropriate privileges, an implementation may indicate success for X_OK even if none of the execute file permission bits are set.
RETURN VALUE If the requested access is permitted, access() succeeds and shall return 0; otherwise, -1 shall be returned and errno shall be set to indicate the error.
二.代码演示
1 0
- realpath和access函数浅谈
- realpath函数的用法
- PHP-dirname()、realpath()函数
- realpath() 函数返回绝对路径
- 函数realpath/mktemp/access/stat以及fsutils工具中的代码例子
- __FILE__,realpath和dirname,
- realpath
- realpath
- realpath
- php realpath()函数的使用
- 函数access和faccessat函数
- access日期和时间函数
- access日期和时间函数
- os.getcwd()和os.path.realpath(__file__)的区别
- linux access()函数和readdir()函数
- linux access()函数和readdir()函数
- linux access()函数和readdir()函数
- malloc 和 free函数浅谈
- davinci dm644x resizer calccoef
- Coreseek自定义中文词库
- swagger
- AngularJS1.x快速入门
- 大帆玩英雄联盟
- realpath和access函数浅谈
- MyBatis配合spring事务处理注解无效的问题
- 搭建一个简单的http服务器
- Java集合(二):List列表
- 2017微众银行校招实习
- 一个只有99行代码的JS流程框架
- 实例介绍利用valgrind定位内存泄漏问题
- Rsync文件同步
- lightoj 1259