程序4-4 chmod函数实例
//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();
}
程序4-4 chmod函数实例的更多相关文章
- 程序清单 8-8 exec函数实例,a.out是程序8-9产生的可执行程序
/* ============================================================================ Name : test.c Author ...
- 程序4-6 utime函数实例
//http://blog.chinaunix.net/uid-24549279-id-71355.html /* ========================================== ...
- 程序4-3 umask函数实例
//http://blog.chinaunix.net/uid-24549279-id-71355.html /* ========================================== ...
- 程序4-2 access函数实例
//http://blog.chinaunix.net/uid-24549279-id-71355.html /* ========================================== ...
- python迭代器与iter()函数实例教程
python迭代器与iter()函数实例教程 发布时间:2014-07-16编辑:脚本学堂 本文介绍了python迭代器与iter()函数的用法,Python 的迭代无缝地支持序列对象,而且它还允许程 ...
- 解决C#程序只允许运行一个实例的几种方法详解
解决C#程序只允许运行一个实例的几种方法详解 本篇文章是对C#中程序只允许运行一个实例的几种方法进行了详细的分析介绍,需要的朋友参考下 本文和大家讲一下如何使用C#来创建系统中只能有该程序的一个实例运 ...
- 解决C# WINFORM程序只允许运行一个实例的几种方法详解
要实现程序的互斥,通常有下面几种方式,下面用 C# 语言来实现: 方法一: 使用线程互斥变量. 通过定义互斥变量来判断是否已运行实例. 把program.cs文件里的Main()函数改为如下代码: u ...
- PHP截取字符串函数substr()函数实例用法详解
在PHP中有一项非常重要的技术,就是截取指定字符串中指定长度的字符.PHP对于字符串截取可以使用PHP预定义函数substr()函数来实现.下面就来介绍一下substr()函数的语法及其应用. sub ...
- C++的友元类和友元函数实例
#include <math.h> #include<iostream> using namespace std; class Point { public: Point(do ...
随机推荐
- NO.4 Android开发中常用框架及工具
android-pulltorefresh 一个强大的拉动刷新开源项目,支持各种控件下拉刷新ListView.ViewPager.WevView.ExpandableListView.GridView ...
- DevExpress打印通用代码
DevExpress打印相关代码 using System;using System.Windows.Forms;using DevExpress.XtraPrinting;using System. ...
- SQL使用事务
BEGIN TRANSACTION--开始事务 DECLARE @errorSun INT --定义错误计数器 SET @errorSun=0 --没错为0 UPDATE a SET id=232 W ...
- Three.js基础:导入STL模型文件
stlloadertest.html: <!DOCTYPE html> <html lang="en"> <head> <title> ...
- python学习笔记(excel简单操作)
现在的目标是设计一个接口自动化测试框架 用例写在excel里面 利用python自带的pyunit构建 之前已经安装好了处理excel的模块 这次简单的使用下 提前创建好excel文件 “testca ...
- Linux find 命令大全
find 含义: 顾名思义,是从来查找满足条件的内容. 从指定目录,递归的查找满足条件的内容. 格式: find [查询目录] [参数] [匹配方式] 文件操作: -name : 查找文件名 ( f ...
- opencv:图像的创建和储存
示例代码: #include <opencv.hpp> #include <vector> using namespace std; using namespace cv; v ...
- 记录下一次错误报http请求500,
1.请求控制层没问题,能请求到,如果缺少参数都会返回提示信息,但是请求参数都对了以后,居然报500,非常不解 找了好久,不知道哪里错了,最后经理提示是不是有可能,mapper.xml出错了,最后,我将 ...
- LeetCode OJ:Multiply Strings (字符串乘法)
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: Th ...
- react use axios拦截器
import axios from 'axios'; improt Promise from 'es6-promise'; Promise.polyfill(); const axiosService ...