程序4-4 chmod函数实例
2024-09-01 16:24:04
//http://blog.chinaunix.net/uid-24549279-id-71355.html
/*
============================================================================
Name : test.c
Author : blank
Version :
Copyright : Your copyright notice
Description : 程序4-4 chmod函数实例
============================================================================
*/ #include <fcntl.h>
#include "ourhdr.h" int main(int argc, char *argv[])
{
struct stat buf;
if (stat("foo", &buf) < ){
err_sys("stat error for foo");
}
/*
* turn on set-group-ID and turn off group-execute
*/
if (chmod("foo", (buf.st_mode & ~S_IXGRP) | S_ISGID) < ){
err_sys("chmod error for foo");
} /*
*set absolute mode to rw-r--r--
*/
if (chmod("bar", (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < ){
err_sys("chmod error for bar");
}
exit();
}
最新文章
- php 多条数据更新
- 关于提交form不刷新的问题
- 《OpenGL着色语言》理解点记录三
- C#入门篇6-8:字符串操作 深入研究字符串的内存驻留机制
- Android百度地图开发(二)地图覆盖物
- QT输入输出(一) 之 QDataStream 测试
- [ZZ+CH] Html5 canvas+js 时钟
- [React] React Fundamentals: Accessing Child Properties
- virtualbox 复制多个虚拟机 (宿主机redhat)
- springboot学习(三)——http序列化/反序列化之HttpMessageConverter
- CodeForces - 796A Buying A House
- Java-- String源码分析
- 阿里云发送短信验证码php_SDK
- PHP 设计模式 单例模式 工厂模式 注册模式
- 解决 nfs挂载错误wrong fs type, bad option, bad superblock
- webstorm皮肤外观样式快速设置,CMD的使用方法,webstorm11激活方法
- JSP,servlet和数据库之间传值出现乱码的问题
- prettytable模块(格式化打印内容)
- 80. Remove Duplicates from Sorted Array II (Array)
- Problem D: 零起点学算法83——数组中删数
热门文章
- HDU 5704
- iOS日常学习 - 让你的 Xcode8 继续使用插件
- windows系统下载地址大全&;大白菜下载和教程
- android studio 更新Gradle版本方法
- Mybatis层次结构图
- c++ std::find函数
- spring的AOP动态代理--JDK代理和CGLIB代理区分以及注意事项
- 在linux上用jmeter压测时出现很多异常java.net.NoRouteToHostException: Cannot assign requested address.
- react 文章
- 【spark】持久化