//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();
}

最新文章

  1. php 多条数据更新
  2. 关于提交form不刷新的问题
  3. 《OpenGL着色语言》理解点记录三
  4. C#入门篇6-8:字符串操作 深入研究字符串的内存驻留机制
  5. Android百度地图开发(二)地图覆盖物
  6. QT输入输出(一) 之 QDataStream 测试
  7. [ZZ+CH] Html5 canvas+js 时钟
  8. [React] React Fundamentals: Accessing Child Properties
  9. virtualbox 复制多个虚拟机 (宿主机redhat)
  10. springboot学习(三)——http序列化/反序列化之HttpMessageConverter
  11. CodeForces - 796A Buying A House
  12. Java-- String源码分析
  13. 阿里云发送短信验证码php_SDK
  14. PHP 设计模式 单例模式 工厂模式 注册模式
  15. 解决 nfs挂载错误wrong fs type, bad option, bad superblock
  16. webstorm皮肤外观样式快速设置,CMD的使用方法,webstorm11激活方法
  17. JSP,servlet和数据库之间传值出现乱码的问题
  18. prettytable模块(格式化打印内容)
  19. 80. Remove Duplicates from Sorted Array II (Array)
  20. Problem D: 零起点学算法83——数组中删数

热门文章

  1. HDU 5704
  2. iOS日常学习 - 让你的 Xcode8 继续使用插件
  3. windows系统下载地址大全&amp;大白菜下载和教程
  4. android studio 更新Gradle版本方法
  5. Mybatis层次结构图
  6. c++ std::find函数
  7. spring的AOP动态代理--JDK代理和CGLIB代理区分以及注意事项
  8. 在linux上用jmeter压测时出现很多异常java.net.NoRouteToHostException: Cannot assign requested address.
  9. react 文章
  10. 【spark】持久化